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

NPE crash on Android when Don't keep activities is enabled #402

Closed
ghost opened this issue Sep 21, 2020 · 6 comments
Closed

NPE crash on Android when Don't keep activities is enabled #402

ghost opened this issue Sep 21, 2020 · 6 comments
Labels
new issue An issue that hasn't yet been seen from the maintainer

Comments

@ghost
Copy link

ghost commented Sep 21, 2020

Describe the bug
The app crashes on Android after picking a file when Don't keep activities under the Developer Options menu is enabled.
It happened on multiple emulators and on my physical device.

Issue details

  1. Platform (Android/iOS): Android.
  2. Platform OS version: Tried on Android 9 and 10.
  3. File type (filter) — when applicable: Any.
  4. Detailed steps to reproduce: Enable Don't keep activities under the Developer Options menu and pick a file.

Error Log

D/FilePickerDelegate( 7481): Selected type */*
D/EGL_emulation( 7481): eglMakeCurrent: 0xe0a1a360: ver 2 0 (tinfo 0xe0a0f140)
W/ActivityThread( 7481): handleWindowVisibility: no activity for token android.os.BinderProxy@425c17
D/eglCodecCommon( 7481): setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation( 7481): eglCreateContext: 0xf3c7e6e0: maj 2 min 0 rcv 2
D/eglCodecCommon( 7481): setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation( 7481): eglCreateContext: 0xf3c7fdc0: maj 2 min 0 rcv 2
D/HostConnection( 7481): HostConnection::get() New Host Connection established 0xdd39fb70, tid 7688
D/HostConnection( 7481): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2 
D/EGL_emulation( 7481): eglMakeCurrent: 0xf3c7fdc0: ver 2 0 (tinfo 0xe8a3c210)
E/AndroidRuntime( 7481): FATAL EXCEPTION: Thread-6
E/AndroidRuntime( 7481): Process: io.kocho, PID: 7481
E/AndroidRuntime( 7481): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime( 7481): 	at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:106)
E/AndroidRuntime( 7481): 	at java.lang.Thread.run(Thread.java:919)
I/Process ( 7481): Sending signal. PID: 7481 SIG: 9

Flutter Version details

[√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [versão 10.0.19041.508], locale pt-BR)
    • Flutter version 1.20.4 at D:\src\flutter
    • Framework revision fba99f6cf9 (7 days ago), 2020-09-14 15:32:52 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at D:\AndroidSdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_SDK_ROOT = D:\AndroidSdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (1 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

Additional context
I found this issue while trying to reproduce this issue: #397

@ghost ghost added the new issue An issue that hasn't yet been seen from the maintainer label Sep 21, 2020
@miguelpruivo
Copy link
Owner

Thank you @DEMndz5. Will take a look as soon as I can.

@chengbieSWL
Copy link

D/FilePickerDelegate(11711): Selected type /
D/EGL_emulation(11711): eglMakeCurrent: 0xe55f4880: ver 3 0 (tinfo 0xde1b1a00)
D/FlutterView(11711): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@2bd7bbf
D/FilePickerDelegate(11711): [SingleFilePick] File URI:content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2F%E6%B5%8B%E8%AF%95%E4%BA%A4%E6%8E%A5%E8%A1%A8.doc
I/FilePickerUtils(11711): Caching from URI: content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2F%E6%B5%8B%E8%AF%95%E4%BA%A4%E6%8E%A5%E8%A1%A8.doc
E/AndroidRuntime(11711): FATAL EXCEPTION: Thread-4
E/AndroidRuntime(11711): Process: com.example.chengtouoa, PID: 11711
E/AndroidRuntime(11711): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime(11711): at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:106)
E/AndroidRuntime(11711): at java.lang.Thread.run(Thread.java:764)
I/Process (11711): Sending signal. PID: 11711 SIG: 9

遇到了类似的问题,需要怎么解决呢?导致app闪退

@miguelpruivo
Copy link
Owner

Fixed with 2.0.5 (even though this is unlikely to happen aside debugging purposes).

Thank you for reporting. 👍

@ghost
Copy link
Author

ghost commented Sep 28, 2020

Thank you. Does this update stop the app from crashing and return the picked file(s)? Or only the former?

A few users left some negative reviews complaining about the app crashing after picking the file and I thought this crash might be related.

I noticed most of the complains were from Huawei users and searching online I found this page talking about how Huawei kills background activities from apps that aren't whitelisted.

@miguelpruivo
Copy link
Owner

@DEMndz5 this will prevent the app crash if the activity is killed but won’t load the file as it will be lost on the way.

The only thing that would make it possible here would be saving the state (overriding onSaveInstanceState and then restoring it) but that would result in other problems as lifecycle observer would be registered multiple times.

@ghost
Copy link
Author

ghost commented Sep 28, 2020

Understood.
Since it's a minority of the users, I'll direct them to the solutions mentioned on that page and see if they work for them.
Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new issue An issue that hasn't yet been seen from the maintainer
Projects
None yet
Development

No branches or pull requests

2 participants