Skip to content

Image_picker plugin fails, if Flutter activity is killed while native one is shown #17950

@mravn-google

Description

@mravn-google

On Android device,

  • Go to System/Developer options and enable the "Don't keep activities" option.
  • Run the image_picker example app and try to pick an image.
java.lang.IllegalStateException: Received images from picker that were not requested
E/AndroidRuntime(31917): Process: io.flutter.plugins.imagepicker.example, PID: 31917
E/AndroidRuntime(31917): java.lang.RuntimeException: Unable to resume activity {io.flutter.plugins.imagepicker.example/io.flutter.plugins.imagepickerexample.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2342, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:11165 flg=0x1 }} to activity {io.flutter.plugins.imagepicker.example/io.flutter.plugins.imagepickerexample.MainActivity}: java.lang.IllegalStateException: Received images from picker that were not requested
E/AndroidRuntime(31917): 	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3581)
E/AndroidRuntime(31917): 	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
E/AndroidRuntime(31917): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862)
E/AndroidRuntime(31917): 	at android.app.ActivityThread.-wrap11(Unknown Source:0)
E/AndroidRuntime(31917): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
E/AndroidRuntime(31917): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(31917): 	at android.os.Looper.loop(Looper.java:164)
E/AndroidRuntime(31917): 	at android.app.ActivityThread.main(ActivityThread.java:6494)
E/AndroidRuntime(31917): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(31917): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/AndroidRuntime(31917): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
E/AndroidRuntime(31917): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2342, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:11165 flg=0x1 }} to activity {io.flutter.plugins.imagepicker.example/io.flutter.plugins.imagepickerexample.MainActivity}: java.lang.IllegalStateException: Received images from picker that were not requested
E/AndroidRuntime(31917): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4268)
E/AndroidRuntime(31917): 	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3553)
E/AndroidRuntime(31917): 	... 10 more
E/AndroidRuntime(31917): Caused by: java.lang.IllegalStateException: Received images from picker that were not requested
E/AndroidRuntime(31917): 	at io.flutter.plugins.imagepicker.ImagePickerDelegate.handleResult(ImagePickerDelegate.java:337)
E/AndroidRuntime(31917): 	at io.flutter.plugins.imagepicker.ImagePickerDelegate.handleChoosePictureResult(ImagePickerDelegate.java:304)
E/AndroidRuntime(31917): 	at io.flutter.plugins.imagepicker.ImagePickerDelegate.onActivityResult(ImagePickerDelegate.java:291)
E/AndroidRuntime(31917): 	at io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:194)
E/AndroidRuntime(31917): 	at io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:146)
E/AndroidRuntime(31917): 	at io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:139)
E/AndroidRuntime(31917): 	at android.app.Activity.dispatchActivityResult(Activity.java:7276)
E/AndroidRuntime(31917): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4264)
E/AndroidRuntime(31917): 	... 11 more

A NullPointerException is thrown instead, if one cancels the picking from the native activity.

Metadata

Metadata

Assignees

Labels

c: crashStack traces logged to the consolep: image_pickerThe Image Picker plugin.packageflutter/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