Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Crash #382

Closed
jensenbuck opened this issue Nov 6, 2016 · 14 comments
Closed

[Android] Crash #382

jensenbuck opened this issue Nov 6, 2016 · 14 comments

Comments

@jensenbuck
Copy link

Created your exact example.
First screen, no problem.
Going to the camera and/or file selector no problem.

Escaping out of the camera or file selector view will crash the app.
Taking a picture and selecting from the camera, or selecting a picture from the file selector will crash the app.

This happens both on an emulated and physical device.

@yfuks
Copy link
Contributor

yfuks commented Nov 6, 2016

Can you past your stack trace ?

@efratyo
Copy link

efratyo commented Nov 7, 2016

Happens to me too. App crashes without an error after few image picking.

@AsafBrieferyDev
Copy link

AsafBrieferyDev commented Nov 8, 2016

I have the same issue - added a quick fix in the comments of #383 . I think those are actually the same issue.

@jensenbuck
Copy link
Author

This doesn't help me either. The example will let me spit out file information, i.e. path, data, etc., but as soon as it is done, the app itself crashes with a "Unfortunately, {Application Name} has stopped."

There is no big red screen that spits out the stacktrace. So, unless there is another way to get the stacktrace that you can point me to (I'm still fairly new with react-native), then I'm at a loss.

@yfuks
Copy link
Contributor

yfuks commented Nov 9, 2016

adb logcat to get java stack trace

@marcshilling marcshilling changed the title Android bug obtaining file [Android] Crash Nov 9, 2016
@chiraggshah
Copy link

chiraggshah commented Nov 9, 2016

@yfuks : I get the same crash with the scenario described. Here is the java stacktrace from adb logcat. I am using v0.21.4 but I guess, the latest version too might give the same error.

1731  2092 E Surface : getSlotFromBufferLocked: unknown buffer: 0xe99a2550
2002  2002 D AndroidRuntime: Shutting down VM
2002  2002 E AndroidRuntime: FATAL EXCEPTION: main
2002  2002 E AndroidRuntime: Process: com.cgrn, PID: 2002
2002  2002 E AndroidRuntime: java.lang.AbstractMethodError: abstract method "void com.facebook.react.bridge.ActivityEventListener.onActivityResult(android.app.Activity, int, int, android.content.Intent)"
2002  2002 E AndroidRuntime:  at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:226)
2002  2002 E AndroidRuntime:  at com.facebook.react.XReactInstanceManagerImpl.onActivityResult(XReactInstanceManagerImpl.java:616)
2002  2002 E AndroidRuntime:  at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:134)
2002  2002 E AndroidRuntime:  at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:77)
2002  2002 E AndroidRuntime:  at android.app.Activity.dispatchActivityResult(Activity.java:6428)
2002  2002 E AndroidRuntime:  at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
2002  2002 E AndroidRuntime:  at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
2002  2002 E AndroidRuntime:  at android.app.ActivityThread.-wrap16(ActivityThread.java)
2002  2002 E AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
2002  2002 E AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:102)
2002  2002 E AndroidRuntime:  at android.os.Looper.loop(Looper.java:148)
2002  2002 E AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5417)
2002  2002 E AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)
2002  2002 E AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
2002  2002 E AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
 744  1112 W ActivityManager:   Force finishing activity com.cgrn/.MainActivity
 744  1987 I OpenGLRenderer: Initialized EGL, version 1.4
 744  1987 W EGL_emulation: eglSurfaceAttrib not implemented
 744  1987 W OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xd941d340, error=EGL_SUCCESS
 744   758 W ActivityManager: Activity pause timeout for ActivityRecord{659b4ef u0 com.cgrn/.MainActivity t74 f}
1113  1261 W EGL_emulation: eglSurfaceAttrib not implemented
1113  1261 W OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xed73f2e0, error=EGL_SUCCESS
1731  1973 E Surface : getSlotFromBufferLocked: unknown buffer: 0xeb0ce380
1731  1731 V StateManager: destroy
2002  2002 I Process : Sending signal. PID: 2002 SIG: 9
 744  1987 E Surface : getSlotFromBufferLocked: unknown buffer: 0xf2cb5f70
 744  1229 I WindowState: WIN DEATH: Window{bc96c2c u0 com.cgrn/com.cgrn.MainActivity}
 744  1111 D GraphicsStats: Buffer count: 5
 744   877 I ActivityManager: Process com.cgrn (pid 2002) has died
 744   763 W AppOps  : Finishing op nesting under-run: uid 1000 pkg android code 24 time=0 duration=0 nesting=0

@chiraggshah
Copy link

@yfuks : On the latest version 0.22.14, image selection from gallery works fine. But from camera, I get the following adb logcat stacktrace:

28089 28089 W art     : Throwing OutOfMemoryError "Failed to allocate a 38937612 byte allocation with 16775936 free bytes and 36MB until OOM"
28089 28089 D skia    : --- decoder->decode returned false
28089 28089 D AndroidRuntime: Shutting down VM
28089 28089 E AndroidRuntime: FATAL EXCEPTION: main
28089 28089 E AndroidRuntime: Process: com.cgrn, PID: 28089
28089 28089 E AndroidRuntime: java.lang.OutOfMemoryError: Failed to allocate a 38937612 byte allocation with 16775936 free bytes and 36MB until OOM
28089 28089 E AndroidRuntime:  at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
28089 28089 E AndroidRuntime:  at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
28089 28089 E AndroidRuntime:  at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:635)
28089 28089 E AndroidRuntime:  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:611)
28089 28089 E AndroidRuntime:  at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:391)
28089 28089 E AndroidRuntime:  at com.imagepicker.ImagePickerModule.getResizedImage(ImagePickerModule.java:594)
28089 28089 E AndroidRuntime:  at com.imagepicker.ImagePickerModule.onActivityResult(ImagePickerModule.java:433)
28089 28089 E AndroidRuntime:  at com.imagepicker.ImagePickerModule$1.callback(ImagePickerModule.java:90)
28089 28089 E AndroidRuntime:  at com.imagepicker.ImagePickerActivityEventListener.onActivityResult(ImagePickerActivityEventListener.java:26)
28089 28089 E AndroidRuntime:  at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:226)
28089 28089 E AndroidRuntime:  at com.facebook.react.XReactInstanceManagerImpl.onActivityResult(XReactInstanceManagerImpl.java:616)
28089 28089 E AndroidRuntime:  at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:134)
28089 28089 E AndroidRuntime:  at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:77)
28089 28089 E AndroidRuntime:  at android.app.Activity.dispatchActivityResult(Activity.java:6470)
28089 28089 E AndroidRuntime:  at android.app.ActivityThread.deliverResults(ActivityThread.java:3716)
28089 28089 E AndroidRuntime:  at android.app.ActivityThread.handleSendResult(ActivityThread.java:3763)
28089 28089 E AndroidRuntime:  at android.app.ActivityThread.-wrap16(ActivityThread.java)
28089 28089 E AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1403)
28089 28089 E AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:102)
28089 28089 E AndroidRuntime:  at android.os.Looper.loop(Looper.java:148)
28089 28089 E AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5443)
28089 28089 E AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)
28089 28089 E AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
28089 28089 E AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
 2123  5367 W ActivityManager:   Force finishing activity com.cgrn/.MainActivity

@yfuks
Copy link
Contributor

yfuks commented Nov 10, 2016

java.lang.OutOfMemoryError: Failed to allocate a 38937612 byte allocation with 16775936 free bytes and 36MB until OOM

Try not resizing your image or try to allocate more memory to your app

@thomasvm
Copy link

thomasvm commented Nov 24, 2016

I also see this behaviour, with react-native 0.0.38, here is my stacktrace

java.lang.AbstractMethodError: abstract method "void com.facebook.react.bridge.ActivityEventListener.onActivityResult(android.app.Activity, int, int, android.content.Intent)"
	at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:226)
	at com.facebook.react.XReactInstanceManagerImpl.onActivityResult(XReactInstanceManagerImpl.java:616)
	at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:134)
	at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:77)
	at android.app.Activity.dispatchActivityResult(Activity.java:6192)
	at android.app.ActivityThread.deliverResults(ActivityThread.java:3570)
	at android.app.ActivityThread.handleSendResult(ActivityThread.java:3617)
	at android.app.ActivityThread.access$1300(ActivityThread.java:151)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1352)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5254)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
  Force finishing activity 1 com.mmyapp/.MainActivity

I fixed it by cleaning previous android builds. I went into my android folder of my app an issues the following command

./gradlew clean

Later builds worked correctly

@Jpoliachik
Copy link

In case others run into this issue, I was getting the same error as @thomasvm above ^, while running react-native 0.37.0 and developing my own Android custom component.

Turns out, I had an old version of react-native-image-picker still installed (not being utilized), but for some reason, onActivityResult in my Custom Component was being called from the old react-native version that react-native-image-picker used as a dependency.

Deleting, or upgrading react-native-image-picker fixed it. I still have no clue how this effected my own Custom Component though...

@GopiKrishna10
Copy link

GopiKrishna10 commented Jul 11, 2017

hi Guys,
i am still facing a issue when I take the picture and press OK button the app get restarted.in all mobiles like redmi note4 and moto g2. am trying to resolve from one day. am not able to solve this can u please help me thanks in advance
i update the version react-native-image-picker from 0.26.3 to 0.22.9. app getting like "unfortunately app has stopped" showing pop up like this.

config

"react-native": "^0.42.3",
"react-native-image-picker": "0.22.9"
db is firebase

options are

var options = {
title: 'Select Avatar',
quality: 0.6,
storageOptions: {
skipBackup: true,
path: 'images'
}
};

@arindam89
Copy link

"react-native": "0.49.3",
"react-native-image-picker": "^0.26.7",
same issue...

@atchuthsai468
Copy link

atchuthsai468 commented Feb 1, 2018

when I take the picture or pick image from gallery and press OK button the app get restarted(without showing any error it goes to first page)
I tried to upload image in firebase database i'm also getting same issue
"react-native": "0.46.4",
"react-native-image-picker": "^0.26.7",
"react-native-firebase": "^2.0.0"
can anyone help me thanks in advance

@marceloguimaraesrarolabs

This issue continues on react-native-image-picker 2.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests