Flutter: FirebaseStorage plugin crashes on Android when uploading image file created by Image Picker

Created on 8 May 2017  Â·  3Comments  Â·  Source: flutter/flutter

Steps to Reproduce

Use the full version of FriendlyChat to send a photo on Android. After picking the photo and returning to the chat screen, app crashes with the logs below.

Android image picking works fine in the image_picker sample app. It also works fine on iOS.

This used to work before so it's probably a regression or race condition.

Logs

05-08 13:33:52.313   811   833 I ActivityManager: Displayed io.flutter.example.friendlychat/com.esafirm.imagepicker.features.ImagePickerActivity: +221ms
05-08 13:33:53.237   811 28032 D NetlinkSocketObserver: NeighborEvent{elapsedMs=280432386, fe80::200:5eff:fe01:265, [00005E000265], RTM_NEWNEIGH, NUD_REACHABLE}
05-08 13:33:53.561   201   849 D audio_hw_primary: out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
05-08 13:33:53.571   201   849 D audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: none)
05-08 13:33:53.571   201   849 D msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(2) acdb_id(15)
05-08 13:33:53.571   201   849 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)
05-08 13:33:53.576   201   849 D audio_hw_primary: enable_audio_route: apply and update mixer path: low-latency-playback
05-08 13:33:53.672  8901  8901 F flutter : [FATAL:../../flutter/shell/platform/android/platform_view_android_jni.cc(29)] Check failed: env->ExceptionCheck() == JNI_FALSE. 
05-08 13:33:53.672  8901  8901 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 8901 (le.friendlychat)
05-08 13:33:53.776   198   198 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-08 13:33:53.776   198   198 F DEBUG   : Build fingerprint: 'google/hammerhead/hammerhead:6.0.1/M4B30Z/3437181:userdebug/dev-keys'
05-08 13:33:53.776   198   198 F DEBUG   : Revision: '11'
05-08 13:33:53.776   198   198 F DEBUG   : ABI: 'arm'
05-08 13:33:53.777   198   198 F DEBUG   : pid: 8901, tid: 8901, name: le.friendlychat  >>> io.flutter.example.friendlychat <<<
05-08 13:33:53.777   198   198 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
05-08 13:33:53.771   198   198 W debuggerd: type=1400 audit(0.0:1619): avc: denied { search } for name="com.google.android.gms" dev="mmcblk0p28" ino=1474612 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
05-08 13:33:53.781   198   198 W debuggerd: type=1400 audit(0.0:1620): avc: denied { search } for name="com.google.android.gms" dev="mmcblk0p28" ino=1474612 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
05-08 13:33:53.824   198   198 F DEBUG   : Abort message: '[FATAL:../../flutter/shell/platform/android/platform_view_android_jni.cc(29)] Check failed: env->ExceptionCheck() == JNI_FALSE. 
05-08 13:33:53.824   198   198 F DEBUG   : '
05-08 13:33:53.824   198   198 F DEBUG   :     r0 00000000  r1 000022c5  r2 00000006  r3 b6f8eb7c
05-08 13:33:53.825   198   198 F DEBUG   :     r4 b6f8eb84  r5 b6f8eb34  r6 0000000b  r7 0000010c
05-08 13:33:53.825   198   198 F DEBUG   :     r8 beb09fbc  r9 aee72d08  sl beb0a028  fp ae3b88e8
05-08 13:33:53.825   198   198 F DEBUG   :     ip 00000006  sp beb09e60  lr b6cfdb61  pc b6cfff50  cpsr 400f0010
05-08 13:33:53.838   198   198 F DEBUG   : 
05-08 13:33:53.838   198   198 F DEBUG   : backtrace:
05-08 13:33:53.839   198   198 F DEBUG   :     #00 pc 00041f50  /system/lib/libc.so (tgkill+12)
05-08 13:33:53.839   198   198 F DEBUG   :     #01 pc 0003fb5d  /system/lib/libc.so (pthread_kill+32)
05-08 13:33:53.839   198   198 F DEBUG   :     #02 pc 0001c30f  /system/lib/libc.so (raise+10)
05-08 13:33:53.839   198   198 F DEBUG   :     #03 pc 000194c1  /system/lib/libc.so (__libc_android_abort+34)
05-08 13:33:53.839   198   198 F DEBUG   :     #04 pc 000174ac  /system/lib/libc.so (abort+4)
05-08 13:33:53.839   198   198 F DEBUG   :     #05 pc 001db349  /data/app/io.flutter.example.friendlychat-2/lib/arm/libflutter.so
05-08 13:33:53.839   198   198 F DEBUG   :     #06 pc 003e2cbf  /data/app/io.flutter.example.friendlychat-2/lib/arm/libflutter.so
05-08 13:33:53.839   198   198 F DEBUG   :     #07 pc 000a0055  /data/app/io.flutter.example.friendlychat-2/lib/arm/libflutter.so
05-08 13:33:53.840   198   198 F DEBUG   :     #08 pc 0009e113  /data/app/io.flutter.example.friendlychat-2/lib/arm/libflutter.so
05-08 13:33:53.840   198   198 F DEBUG   :     #09 pc 000bb30b  /data/app/io.flutter.example.friendlychat-2/lib/arm/libflutter.so
05-08 13:33:53.840   198   198 F DEBUG   :     #10 pc 000a560b  /data/app/io.flutter.example.friendlychat-2/lib/arm/libflutter.so
05-08 13:33:53.840   198   198 F DEBUG   :     #11 pc 000a8167  /data/app/io.flutter.example.friendlychat-2/lib/arm/libflutter.so
05-08 13:33:53.840   198   198 F DEBUG   :     #12 pc 00012e93  /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+530)
05-08 13:33:53.840   198   198 F DEBUG   :     #13 pc 00012f63  /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+130)
05-08 13:33:53.840   198   198 F DEBUG   :     #14 pc 00081d05  /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
05-08 13:33:53.840   198   198 F DEBUG   :     #15 pc 7197d56d  /data/dalvik-cache/arm/system@[email protected] (offset 0x1ed5000)
05-08 13:33:54.311   198   198 W debuggerd: type=1400 audit(0.0:1621): avc: denied { search } for name="com.google.android.gms" dev="mmcblk0p28" ino=1474612 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
05-08 13:33:54.556   811  9064 W ActivityManager:   Force finishing activity io.flutter.example.friendlychat/.MainActivity
05-08 13:33:54.557   198   198 F DEBUG   : 
05-08 13:33:54.557   198   198 F DEBUG   : Tombstone written to: /data/tombstones/tombstone_00
05-08 13:33:54.557   198   198 E DEBUG   : AM write failed: Broken pipe
05-08 13:33:54.557   811   831 I BootReceiver: Copying /data/tombstones/tombstone_00 to DropBox (SYSTEM_TOMBSTONE)
05-08 13:33:54.604   811  1856 D GraphicsStats: Buffer count: 6
05-08 13:33:54.614   811   923 W InputDispatcher: channel 'fd8147b io.flutter.example.friendlychat/io.flutter.example.friendlychat.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
05-08 13:33:54.614   811   923 E InputDispatcher: channel 'fd8147b io.flutter.example.friendlychat/io.flutter.example.friendlychat.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
05-08 13:33:54.621   811   923 W InputDispatcher: channel 'c728fc3 io.flutter.example.friendlychat/com.esafirm.imagepicker.features.ImagePickerActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
05-08 13:33:54.621   811   923 E InputDispatcher: channel 'c728fc3 io.flutter.example.friendlychat/com.esafirm.imagepicker.features.ImagePickerActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
05-08 13:33:54.628   212   212 I Zygote  : Process 8901 exited due to signal (6)
05-08 13:33:54.630   811  1879 I WindowState: WIN DEATH: Window{9066758 u0 SurfaceView}
05-08 13:33:54.631   811  3780 I WindowState: WIN DEATH: Window{c728fc3 u0 io.flutter.example.friendlychat/com.esafirm.imagepicker.features.ImagePickerActivity}
05-08 13:33:54.631   811  3780 W InputDispatcher: Attempted to unregister already unregistered input channel 'c728fc3 io.flutter.example.friendlychat/com.esafirm.imagepicker.features.ImagePickerActivity (server)'
05-08 13:33:54.632   811  2210 I WindowState: WIN DEATH: Window{fd8147b u0 io.flutter.example.friendlychat/io.flutter.example.friendlychat.MainActivity}
05-08 13:33:54.632   811  2210 W InputDispatcher: Attempted to unregister already unregistered input channel 'fd8147b io.flutter.example.friendlychat/io.flutter.example.friendlychat.MainActivity (server)'
05-08 13:33:54.881   811  9064 I WindowManager: Screenshot max retries 4 of Token{a7b8302 ActivityRecord{8e72c4d u0 io.flutter.example.friendlychat/.MainActivity t257 f}} appWin=Window{9066758 u0 SurfaceView EXITING} drawState=3
05-08 13:33:54.888   811  9064 W ActivityManager: Exception thrown during pause
05-08 13:33:54.888   811  9064 W ActivityManager: android.os.DeadObjectException
05-08 13:33:54.888   811  9064 W ActivityManager:   at android.os.BinderProxy.transactNative(Native Method)
05-08 13:33:54.888   811  9064 W ActivityManager:   at android.os.BinderProxy.transact(Binder.java:503)
05-08 13:33:54.888   811  9064 W ActivityManager:   at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:727)
05-08 13:33:54.888   811  9064 W ActivityManager:   at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:867)
05-08 13:33:54.888   811  9064 W ActivityManager:   at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2907)
05-08 13:33:54.888   811  9064 W ActivityManager:   at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2763)
05-08 13:33:54.888   811  9064 W ActivityManager:   at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2760)
05-08 13:33:54.888   811  9064 W ActivityManager:   at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:12052)
05-08 13:33:54.888   811  9064 W ActivityManager:   at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:11948)
05-08 13:33:54.888   811  9064 W ActivityManager:   at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12637)
05-08 13:33:54.888   811  9064 W ActivityManager:   at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:12144)
05-08 13:33:54.888   811  9064 W ActivityManager:   at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
05-08 13:33:54.900   188   188 E lowmemorykiller: Error opening /proc/8901/oom_score_adj; errno=2
05-08 13:33:54.918   811   811 W art     : Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12583 waiters=0 for 333ms
05-08 13:33:54.918   811   825 W art     : Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12583 waiters=1 for 330ms
05-08 13:33:54.919   811   827 W art     : Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12583 waiters=3 for 297ms
05-08 13:33:54.927   811   822 I ActivityManager: Process io.flutter.example.friendlychat (pid 8901) has died
05-08 13:33:54.927   811   822 D ActivityManager: cleanUpApplicationRecord -- 8901
05-08 13:33:55.004   811  3866 I OpenGLRenderer: Initialized EGL, version 1.4
05-08 13:33:55.068  8160  8160 E WorkerRegistryImpl: getWorker() is called after WorkerRegistry disposal.
05-08 13:33:55.068  8160  8160 E WorkerRegistryImpl: getWorker() is called after WorkerRegistry disposal.
05-08 13:33:55.460   811   833 W WindowAnimator: Failed to dispatch window animation state change.
05-08 13:33:55.460   811   833 W WindowAnimator: android.os.DeadObjectException
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.os.BinderProxy.transactNative(Native Method)
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.os.BinderProxy.transact(Binder.java:503)
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534)
05-08 13:33:55.460   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:286)
05-08 13:33:55.460   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:678)
05-08 13:33:55.460   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator.-wrap0(WindowAnimator.java)
05-08 13:33:55.460   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.view.Choreographer.doCallbacks(Choreographer.java:670)
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.view.Choreographer.doFrame(Choreographer.java:603)
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.os.Handler.handleCallback(Handler.java:739)
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.os.Handler.dispatchMessage(Handler.java:95)
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.os.Looper.loop(Looper.java:148)
05-08 13:33:55.460   811   833 W WindowAnimator:    at android.os.HandlerThread.run(HandlerThread.java:61)
05-08 13:33:55.460   811   833 W WindowAnimator:    at com.android.server.ServiceThread.run(ServiceThread.java:46)
05-08 13:33:55.461   811   833 W WindowAnimator: Failed to dispatch window animation state change.
05-08 13:33:55.461   811   833 W WindowAnimator: android.os.DeadObjectException
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.os.BinderProxy.transactNative(Native Method)
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.os.BinderProxy.transact(Binder.java:503)
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534)
05-08 13:33:55.461   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:286)
05-08 13:33:55.461   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:678)
05-08 13:33:55.461   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator.-wrap0(WindowAnimator.java)
05-08 13:33:55.461   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.view.Choreographer.doCallbacks(Choreographer.java:670)
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.view.Choreographer.doFrame(Choreographer.java:603)
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.os.Handler.handleCallback(Handler.java:739)
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.os.Handler.dispatchMessage(Handler.java:95)
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.os.Looper.loop(Looper.java:148)
05-08 13:33:55.461   811   833 W WindowAnimator:    at android.os.HandlerThread.run(HandlerThread.java:61)
05-08 13:33:55.461   811   833 W WindowAnimator:    at com.android.server.ServiceThread.run(ServiceThread.java:46)
05-08 13:33:55.462   811   833 W WindowAnimator: Failed to dispatch window animation state change.
05-08 13:33:55.462   811   833 W WindowAnimator: android.os.DeadObjectException
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.os.BinderProxy.transactNative(Native Method)
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.os.BinderProxy.transact(Binder.java:503)
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534)
05-08 13:33:55.462   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:286)
05-08 13:33:55.462   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:678)
05-08 13:33:55.462   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator.-wrap0(WindowAnimator.java)
05-08 13:33:55.462   811   833 W WindowAnimator:    at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.view.Choreographer.doCallbacks(Choreographer.java:670)
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.view.Choreographer.doFrame(Choreographer.java:603)
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.os.Handler.handleCallback(Handler.java:739)
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.os.Handler.dispatchMessage(Handler.java:95)
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.os.Looper.loop(Looper.java:148)
05-08 13:33:55.462   811   833 W WindowAnimator:    at android.os.HandlerThread.run(HandlerThread.java:61)
05-08 13:33:55.462   811   833 W WindowAnimator:    at com.android.server.ServiceThread.run(ServiceThread.java:46)
05-08 13:33:56.437   811   934 D ConnectivityService: notifyType CAP_CHANGED for NetworkAgentInfo [WIFI () - 107]
05-08 13:33:56.723  8160  9102 I EventLogSendingHelper: Sending log events.

Flutter Doctor

[✓] Flutter (on Mac OS X 10.12.4 16E195, channel unknown)
• Flutter at /Users/jackson/git/flutter
• Framework revision 0652737f3b (3 days ago), 2017-05-05 09:34:55 -0500
• Engine revision 0071651ecb
• Tools Dart version 1.23.0-dev.11.11

[✓] Android toolchain - develop for Android devices (Android SDK 25.0.2)
• Android SDK at /Users/jackson/Library/Android/sdk/
• Platform android-25, build-tools 25.0.2
• ANDROID_HOME = /Users/jackson/Library/Android/sdk/
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version: OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] iOS toolchain - develop for iOS devices (Xcode 8.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.1, Build version 8E1000a
• ios-deploy 1.9.1
• CocoaPods version 1.0.1

[✓] Android Studio (version 2.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Gradle version 3.2
• Java version: OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Community Edition (version 2016.3.4)
• Dart plugin version 163.13137
• Flutter plugin version 0.1.11.2

[✓] Connected devices
• Nexus 5 • 07e401a0d00b3699 • android-arm • Android 6.0.1 (API 23)
• iPhone 7 Plus • 5F90A4C3-6F80-446A-88CB-5394635BF8EF • ios • iOS 10.3 (simulator)

first party

Most helpful comment

I figured it out, we were depending on different Firebase versions in the Storage plugin versus the other plugins. The mismatched Firebase versions caused an exception we wouldn't catch.

All 3 comments

Well, this is the line:
https://github.com/flutter/engine/blob/master/shell/platform/android/platform_view_android_jni.cc#L29

Presumably that happens when there is an uncaught java exception during a PlatformMessage callback? @jason-simmons or @jakobr-google might know.

I'm investigating and it looks like the exception is coming from Firebase Storage, not the image picker. So the fix will need to go there.

I figured it out, we were depending on different Firebase versions in the Storage plugin versus the other plugins. The mismatched Firebase versions caused an exception we wouldn't catch.

Was this page helpful?
0 / 5 - 0 ratings