miguelpruivo / flutter_file_picker

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.
MIT License
1.35k stars 672 forks source link

Xiaomi - App crashes when open native finder #1608

Closed felipecastrosales closed 1 week ago

felipecastrosales commented 1 month ago

Hey everyone, how’s it going?

I’ve been facing an issue with the FilePicker on a specific device for a while now: the Xiaomi Redmi Note 9, running MIUI 13.0.2 on Android 12.

The problem is that whenever I open the pickFiles dialog, my app automatically closes. This happens both in my production app, which has millions of users, and in the example app, so it seems unlikely that the issue is specific to the app I’m working on.

I’ve looked into potential causes on Android but haven’t reached any clear conclusion on what might be causing the problem or how to solve it.

A few additional details that may or may not be relevant:

I don’t necessarily think these details are directly related, but they’re something I noticed while testing.


For more details, here’s the logcat output:


Videos

https://github.com/user-attachments/assets/6c9f7063-c208-467f-a422-933909068e4f

https://github.com/user-attachments/assets/5dea8a65-2848-4ebc-9147-e37b10b78e2b


Flutter Version details ``` [✓] Flutter (Channel stable, 3.24.0, on macOS 15.0.1 24A348 darwin-arm64, locale en-BR) • Flutter version 3.24.0 on channel stable at /Users/felipe/fvm/versions/3.24.0 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 80c2e84975 (2 months ago), 2024-07-30 23:06:49 +0700 • Engine revision b8800d88be • Dart version 3.5.0 • DevTools version 2.37.2 [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Android SDK at /Users/felipe/Library/Android/sdk • Platform android-35, build-tools 35.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314) • All Android licenses accepted. [!] Xcode - develop for iOS and macOS ✗ Xcode installation is incomplete; a full installation is necessary for iOS and macOS development. Download at: https://developer.apple.com/xcode/ Or install Xcode via the App Store. Once installed, run: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2024.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314) [✓] VS Code (version 1.94.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.98.0 [✓] Connected device (3 available) • M2003J15SC (mobile) • 192.168.3.31:5555 • android-arm64 • Android 12 (API 31) • macOS (desktop) • macos • darwin-arm64 • macOS 15.0.1 24A348 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 129.0.6668.90 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ```

Here’s the translation:


I’d like the maintainers to take a look or offer suggestions for this issue, as it seems to be something specific to Xiaomi devices (particularly the one mentioned above, which I’ve been using for some time). I’ve tested on other devices from the same brand, and the issue didn’t occur. However, I’m not sure if those devices were running the same Android/Xiaomi versions as mine—or if they were different models. Thanks!

felipecastrosales commented 1 month ago

I tried adding the entire error log here, but GitHub limits the issue size, so it didn’t fit. I had to make some adjustments.

cc @miguelpruivo

felipecastrosales commented 1 month ago

This looks for me be the reason of error:

2024-10-08 14:37:00.470 20005-20005 MsyncFactory            com...ter.plugin.filepicker.example  E  [static] ClassNotFoundException
java.lang.ClassNotFoundException: com.mediatek.view.impl.MsyncFactoryImpl
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:607)
    at java.lang.Class.forName(Class.java:512)
    at com.mediatek.view.MsyncFactory.<clinit>(MsyncFactory.java:14)
    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:763)
    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:859)
    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:393)
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:134)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5012)
    at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2325)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:210)
    at android.os.Looper.loop(Looper.java:299)
    at android.app.ActivityThread.main(ActivityThread.java:8280)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073)
Caused by: java.lang.ClassNotFoundException: com.mediatek.view.impl.MsyncFactoryImpl
    at java.lang.Class.classForName(Native Method)
    at java.lang.BootClassLoader.findClass(ClassLoader.java:2693)
    at java.lang.BootClassLoader.loadClass(ClassLoader.java:2753)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
    at java.lang.Class.classForName(Native Method) 
    at java.lang.Class.forName(Class.java:607) 
    at java.lang.Class.forName(Class.java:512) 
    at com.mediatek.view.MsyncFactory.<clinit>(MsyncFactory.java:14) 
    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:763) 
    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:859) 
    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:393) 
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:134) 
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5012) 
    at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54) 
    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45) 
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) 
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2325) 
    at android.os.Handler.dispatchMessage(Handler.java:106) 
    at android.os.Looper.loopOnce(Looper.java:210) 
    at android.os.Looper.loop(Looper.java:299) 
    at android.app.ActivityThread.main(ActivityThread.java:8280) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073) 
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
github-actions[bot] commented 1 month ago

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

felipecastrosales commented 1 month ago

new activity now

MarcioHenriqueVS commented 1 month ago

Estou tendo o mesmo problema, se conseguir resolver aviso aqui

felipecastrosales commented 1 month ago

@miguelpruivo can u see this

felipecastrosales commented 1 month ago

I opened an pr at https://github.com/miguelpruivo/flutter_file_picker/pull/1611

github-actions[bot] commented 3 weeks ago

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

github-actions[bot] commented 1 week ago

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