miguelpruivo/flutter_file_picker

Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference

Closed this issue · 7 comments

Seeing the same issue for some users, it's more popular on Xiaomi devices than others, but it's on some Samsung, Google too.

Noticed same exception in our flutter app with filepicker 6.2.0, it was all working fine till last month. Yesterday one of our tester reported app force closing after picking image. We were able to reproduce the same issue in latest A14 emulator.

emulator: sdk_gphone64_x86_64-userdebug 14 UE1A.230829.036.A1 11228894 dev-keys

edit: found that this issue is related to #1461

Possibly related to #1473

This issue is stale because it has been open for 7 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.

flutter package version:
file_picker: ^6.2.0

I have the same problem. It happened when using
Android 13 (SDK 33)
Android 14 (SDK 34)

google oriole
realme RE879AL1
samsung a52sxq

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference
  at com.mr.flutter.plugin.filepicker.FileUtils.compressImage (FileUtils.java)
  at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run (FilePickerDelegate.java)
  at java.lang.Thread.run (Thread.java:1012)

file_picker: ^8.0.3

SDK-> Flutter 3.22.0, Dart 3.4.0

I also got the same crash on picking images on Android 10 (SDK 29)
Devices:
Oppo F7, Google Pixel

Code:
files = await FilePicker.platform.pickFiles( type: FileType.image, allowMultiple: true, allowCompression: false );

Error:
Exception java.lang.RuntimeException: java.io.IOException: Permission denied at com.mr.flutter.plugin.filepicker.FileUtils.compressImage (FileUtils.java) at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run (FilePickerDelegate.java)