Skip to content

NPE on image_picker 0.4.1 Plugin #17186

@putraxor

Description

@putraxor
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference

ImageResizer.java line 48

Fatal Exception: java.lang.RuntimeException
Failure delivering result ResultInfo{who=null, request=2342, result=-1, data=Intent { dat=content://com.google.android.apps.docs.storage/document/acc=1;doc=2 flg=0x1 }} to activity {id.tridee.mobile/id.tridee.mobile.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
android.app.ActivityThread.deliverResults (ActivityThread.java:4162)
android.app.ActivityThread.handleSendResult (ActivityThread.java:4205)
android.app.ActivityThread.-wrap20 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1572)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:163)
android.app.ActivityThread.main (ActivityThread.java:6221)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:904)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:794)

**Caused by java.lang.NullPointerException**
Attempt to invoke virtual method `'int android.graphics.Bitmap.getWidth()'` on a null object reference
`io.flutter.plugins.imagepicker.ImageResizer.resizedImage`

io.flutter.plugins.imagepicker.ImageResizer.resizedImage (ImageResizer.java:48)
io.flutter.plugins.imagepicker.ImageResizer.resizeImageIfNeeded (ImageResizer.java:37)
io.flutter.plugins.imagepicker.ImagePickerDelegate.handleResult (ImagePickerDelegate.java:262)
io.flutter.plugins.imagepicker.ImagePickerDelegate.handleChoosePictureResult (ImagePickerDelegate.java:230)
io.flutter.plugins.imagepicker.ImagePickerDelegate.onActivityResult (ImagePickerDelegate.java:217)
io.flutter.app.FlutterPluginRegistry.onActivityResult (FlutterPluginRegistry.java:194)
io.flutter.app.FlutterActivityDelegate.onActivityResult (FlutterActivityDelegate.java:139)
io.flutter.app.FlutterActivity.onActivityResult (FlutterActivity.java:128)
android.app.Activity.dispatchActivityResult (Activity.java:7128)
android.app.ActivityThread.deliverResults (ActivityThread.java:4158)
android.app.ActivityThread.handleSendResult (ActivityThread.java:4205)
android.app.ActivityThread.-wrap20 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1572)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:163)
android.app.ActivityThread.main (ActivityThread.java:6221)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:904)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:794)

# ImagePickerDelegate.java line 265

**Fatal Exception: java.lang.RuntimeException**
Unable to resume activity {id.tridee.mobile/id.tridee.mobile.MainActivity}: java.lang.RuntimeException: Failure delivering result `ResultInfo{who=null, request=2342, result=-1, data=Intent { dat=content://media/external/images/media/103134 (has extras) }} to activity {id.tridee.mobile/id.tridee.mobile.MainActivity}`: java.lang.IllegalStateException: Received images from picker that were not requested
android.app.ActivityThread.performResumeActivity
**Caused by java.lang.RuntimeException**
Failure delivering result `ResultInfo{who=null, request=2342, result=-1, data=Intent { dat=content://media/external/images/media/103134 (has extras) }}` to activity {id.tridee.mobile/id.tridee.mobile.MainActivity}: java.lang.IllegalStateException: Received images from picker that were not requested
android.app.ActivityThread.deliverResults

**Caused by java.lang.IllegalStateException**
Received images from picker that were not requested

io.flutter.plugins.imagepicker.ImagePickerDelegate.handleResult (ImagePickerDelegate.java:265)
io.flutter.plugins.imagepicker.ImagePickerDelegate.handleChoosePictureResult (ImagePickerDelegate.java:230)
io.flutter.plugins.imagepicker.ImagePickerDelegate.onActivityResult (ImagePickerDelegate.java:217)
io.flutter.app.FlutterPluginRegistry.onActivityResult (FlutterPluginRegistry.java:194)
io.flutter.app.FlutterActivityDelegate.onActivityResult (FlutterActivityDelegate.java:139)
io.flutter.app.FlutterActivity.onActivityResult (FlutterActivity.java:128)
android.app.Activity.dispatchActivityResult (Activity.java:5639)
android.app.ActivityThread.deliverResults (ActivityThread.java:3637)
android.app.ActivityThread.performResumeActivity (ActivityThread.java:3043)
android.app.ActivityThread.handleResumeActivity (ActivityThread.java:3085)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2498)
android.app.ActivityThread.access$800 (ActivityThread.java:166)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1283)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:136)
android.app.ActivityThread.main (ActivityThread.java:5590)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1280)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1096)
dalvik.system.NativeStart.main (NativeStart.java)

flutter doctor

[✓] Flutter (Channel master, v0.3.6-pre.68, on Linux, locale en_US.UTF-8)
    • Flutter version 0.3.6-pre.68 at /home/putraxor/DEV/flutter
    • Framework revision 1680e55c02 (30 hours ago), 2018-04-30 23:29:46 -0400
    • Engine revision 613aae032f
    • Dart version 2.0.0-dev.50.0.flutter-cd0c4e4fe1

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /home/putraxor/Android/Sdk
    • Android NDK at /home/putraxor/Android/Sdk/ndk-bundle
    • Platform android-27, build-tools 27.0.3
    • ANDROID_HOME = /home/putraxor/Android/Sdk
    • Java binary at: /home/putraxor/DEV/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] Android Studio (version 3.1)
    • Android Studio at /home/putraxor/DEV/android-studio
    • Flutter plugin version 23.2.2
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.2)
    • IntelliJ at /home/putraxor/DEV/idea-IU-172.3757.52
    • Flutter plugin version 21.2.2
    • Dart plugin version 172.4343.25

[✓] VS Code (version 1.22.2)
    • VS Code at /usr/share/code
    • Dart Code extension version 2.12.0

[!] Connected devices
    ! No devices available

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consolepackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions