question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes when scrolling a lot in android

See original GitHub issue

react-native v0.21

After scrolling a lot (about 200 images) in the gallery, the app crashes:

E/AndroidRuntime(30838): java.lang.OutOfMemoryError: Failed to allocate a 51916812 byte allocation with 16777216 free bytes and 38MB until OOM
E/AndroidRuntime(30838):    at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
E/AndroidRuntime(30838):    at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
E/AndroidRuntime(30838):    at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:634)
E/AndroidRuntime(30838):    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:610)
E/AndroidRuntime(30838):    at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:392)
E/AndroidRuntime(30838):    at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:418)
E/AndroidRuntime(30838):    at com.imagepicker.ImagePickerModule.getResizedImage(ImagePickerModule.java:484)
E/AndroidRuntime(30838):    at com.imagepicker.ImagePickerModule.onActivityResult(ImagePickerModule.java:388)
E/AndroidRuntime(30838):    at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:173)
E/AndroidRuntime(30838):    at com.facebook.react.ReactInstanceManagerImpl.onActivityResult(ReactInstanceManagerImpl.java:526)
E/AndroidRuntime(30838):    at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:180)
E/AndroidRuntime(30838):    at android.app.Activity.dispatchActivityResult(Activity.java:6192)
E/AndroidRuntime(30838):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3603)
E/AndroidRuntime(30838):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3650)
E/AndroidRuntime(30838):    at android.app.ActivityThread.access$1400(ActivityThread.java:154)
E/AndroidRuntime(30838):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1370)
E/AndroidRuntime(30838):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(30838):    at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(30838):    at android.app.ActivityThread.main(ActivityThread.java:5294)
E/AndroidRuntime(30838):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(30838):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(30838):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
E/AndroidRuntime(30838):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
agrasscommented, Feb 1, 2017

Same problem:

Fatal Exception: java.lang.OutOfMemoryError
       at android.graphics.BitmapFactory.nativeDecodeStream(BitmapFactory.java)
       at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:620)
       at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
       at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:376)
       at com.imagepicker.ImagePickerModule.getResizedImage(ImagePickerModule.java:594)
0reactions
cpfeiffercommented, Nov 23, 2017

The default value is already 1.0, just make sure you don’t set a different value. See https://github.com/react-community/react-native-image-picker/#usage for setting the options.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android app crashes while scrolling down - Stack Overflow
I am developing a blogging app for android and I am using firebase for the backend. The app is working fine but the...
Read more >
Crashes | Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
app crashing when scrolling too fast, a listview ... - Reddit
After I populate my listview, it downloads the bitmap from the url. I notice when I scroll up or down fast, I see...
Read more >
App crashes when scrolling a lot in android #155 - GitHub
Hi! I've been running into this issue as well and the reason seems to be that you decode the images in full resolution...
Read more >
App crashes when scrolling - Fitbit Community
When scrolling in the app, the app crashes abs closes as soon as I get to the sleep score data. Please help!!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found