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

FilePicker reports NPE crashes in Google Play Console #397

Closed
Arcturus5404 opened this issue Sep 20, 2020 · 23 comments
Closed

FilePicker reports NPE crashes in Google Play Console #397

Arcturus5404 opened this issue Sep 20, 2020 · 23 comments
Labels
android Issue applies to Android platform triage Further information is requested

Comments

@Arcturus5404
Copy link

Describe the bug
Google Play Console reports the following:

java.lang.NullPointerException

java.lang.NullPointerException: 
  at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run (FilePickerDelegate.java:128)
  at java.lang.Thread.run (Thread.java:919)

Issue details

  1. Platform Android
  2. Detailed steps to reproduce:
    I currently have no way to reproduce this issue. It works on all emulators I have tested, so I have no idea how serious this problem is.

Error Log
None

Screenshots and/or video
None

Flutter Version details
flutter --version
Flutter 1.20.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision fba99f6cf9 (3 days ago) • 2020-09-14 15:32:52 -0700
Engine • revision d1bc06f032
Tools • Dart 2.9.2

Additional context
Version

  • file_picker 2.0.0
@Arcturus5404 Arcturus5404 added the new issue An issue that hasn't yet been seen from the maintainer label Sep 20, 2020
@miguelpruivo
Copy link
Owner

@Arcturus5404 hi! Thank you for reporting.

This is quite odd actually, it’s throwing a null pointer on an array method in a place where it can’t ever be null (a few lines before it’s instanciated). Could you please post full stack trace?

Thank you!

@miguelpruivo miguelpruivo added android Issue applies to Android platform triage Further information is requested and removed new issue An issue that hasn't yet been seen from the maintainer labels Sep 20, 2020
@Arcturus5404
Copy link
Author

Arcturus5404 commented Sep 20, 2020

That's all I have in Google Play Console I'm afraid..

One other interesting detail: I have 12 crash reports
11 on Samsung Galaxy A10e Android 10 (SDK 29)
1 on LGE QStylus Android 8.1 (SDK 27)

Not sure of that is of any matter of that its just 1 user trying several times in case of Samsung

EDIT Huawei was on an old version, hence the edit!

@Arcturus5404
Copy link
Author

image

@Arcturus5404
Copy link
Author

Arcturus5404 commented Sep 20, 2020

I checked your file as well.. can never be null.. is there something weird with my code perhaps?

I use one for images:

FilePickerResult images =
                          await FilePicker.platform.pickFiles(type: FileType.image, allowMultiple: true);

                      if (images != null && images.paths.isNotEmpty) {
                        List<File> files = images.paths.map((path) => File(path)).toList();
                        setState(() => _stream = chooseAttachments(files));
                      }

and one for PDFs:

FilePickerResult pdfs = await FilePicker.platform.pickFiles(
                       allowMultiple: true,
                       type: FileType.custom,
                       allowedExtensions: ['pdf'],
                     );

                     if (pdfs != null && pdfs.paths.isNotEmpty) {
                       List<File> files = pdfs.paths.map((path) => File(path)).toList();

                       setState(() => _stream = chooseAttachments(files));
                     }

No clue which ons causes the crashes though :/

@miguelpruivo
Copy link
Owner

Does those crashes happen with apps that are using file picker 2.0.0 as well?

@Arcturus5404
Copy link
Author

Yes! Those are with 2.0.0 file_picker

@miguelpruivo
Copy link
Owner

@Arcturus5404 which version of Flutter are you at?

@ghost
Copy link

ghost commented Sep 21, 2020

Hello, I've been having these same reports since launch (2 months ago).
I'm now using file_picker 1.13.3, flutter 1.20.4 and the crashes continue.
I don't know if this could be related but I managed to reproduce a crash following these steps:
flutter/flutter#17950
Settings->Developer options->Don't keep activities

image

@miguelpruivo
Copy link
Owner

@DEMndz5 what are the steps to reproduce the issue? After picking?

@ghost
Copy link

ghost commented Sep 21, 2020

Yes, the app crashes right after picking.

@miguelpruivo
Copy link
Owner

@DEMndz5 and you get a null pointer just like the OP?

@ghost
Copy link

ghost commented Sep 21, 2020

Yes, this is what I'm getting on the console:
E/AndroidRuntime( 5737): FATAL EXCEPTION: Thread-6 E/AndroidRuntime( 5737): Process: io.kocho, PID: 5737 E/AndroidRuntime( 5737): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference E/AndroidRuntime( 5737): at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:111) E/AndroidRuntime( 5737): at java.lang.Thread.run(Thread.java:919)

@miguelpruivo
Copy link
Owner

miguelpruivo commented Sep 21, 2020

@DEMndz5 your issue looks different (it might actually be a bug) as it relates to a different line. How are you picking the files?

PS: strangely, it references line 111 which is a blank line on latest version (only 112 has an equals() method).

@ghost
Copy link

ghost commented Sep 21, 2020

I haven't updated to 2.0.0. I can try that later and post the results.
My issue is actually the same as OP but I was trying to reproduce the issue.

@miguelpruivo
Copy link
Owner

@DEMndz5 I suspect you are using 1.13.2.

Could you please try with 2.0.0 (you'll have to refactor a bit of code, but it's worth it) and let me know if it still happens, and if so, which line (perhaps open an issue with that)?

Thank you.

@miguelpruivo
Copy link
Owner

@Arcturus5404 I don't see nothing wrong with your code. Are you able to replicate it with a sample app?

@Arcturus5404
Copy link
Author

Arcturus5404 commented Sep 23, 2020

@Arcturus5404 I don't see nothing wrong with your code. Are you able to replicate it with a sample app?

No I am not I'm afraid.. I tried all different kinds of emulators. I do not have these model phones, as I only use Pixels at home.

I am on the following flutter version btw:

== Use Flutter channel stable ==
> flutter --version
Flutter 1.20.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision fba99f6cf9 (3 days ago) • 2020-09-14 15:32:52 -0700
Engine • revision d1bc06f032
Tools • Dart 2.9.2

@Arcturus5404
Copy link
Author

Maybe the issues are related from @DEMndz5, as I build my apks in release / app bundles? Maybe stuff gets confiscated when reports are being sent to the play console?

@miguelpruivo
Copy link
Owner

@Arcturus5404 any news on this?

@Arcturus5404
Copy link
Author

No nothing.. I think its only happening with a few of my users (3 to be precise).

image

I will close the issue, and report back once it becomes a bigger issue!

@miguelpruivo
Copy link
Owner

@Arcturus5404 probably some of those OEM Android ROMS that might be interfering somehow with the correct activity lifecycle. It's not the first time that this happens, specially if those errors happens all on the same devices.

@Arcturus5404
Copy link
Author

Probably yes! I will keep an eye out on the crash monitor! :) Thanks for your time! Much appreciated

@miguelpruivo
Copy link
Owner

@Arcturus5404 this should be fixed with 2.0.5. It turns out that if some devices destroyed activity while picking files, it could indeed result in a NPE. This was fixed today regarding #402.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Issue applies to Android platform triage Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants