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.36k stars 676 forks source link

Not working after build --release using gradle > 4 #504

Closed monisnap-julien closed 4 years ago

monisnap-julien commented 4 years ago

Describe the bug On Android, when using gradle 4 (in my case gradle 4.0.2, the app is not launching correclty after a build --release.

Issue details The first issue (which is a logcat warning) is :

Rejecting re-init on previously-failed class java.lang.Class<com.mr.flutter.plugin.filepicker.FilePickerPlugin$LifeCycleObserver>: java.lang.IllegalAccessError: Interface androidx.lifecycle.b implemented by class com.mr.flutter.plugin.filepicker.FilePickerPlugin$LifeCycleObserver is inaccessible (declaration of 'com.mr.flutter.plugin.filepicker.FilePickerPlugin$LifeCycleObserver' appears in base.apk)

And the error that make the app crashing is :

[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core)

Flutter Version details [✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.7 19H15, locale fr-FR) • Flutter version 1.22.3 at /Users/julien/flutter • Framework revision 8874f21e79 (3 weeks ago), 2020-10-29 14:14:35 -0700 • Engine revision a1440ca392 • Dart version 2.10.3

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/julien/Library/Android/sdk • Platform android-30, build-tools 29.0.2 • ANDROID_HOME = /Users/julien/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.0, Build version 12A7209 • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 49.0.2 • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.51.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.16.0

[✓] Connected device (1 available) • ONEPLUS A3003 (mobile) • 7a41d410 • android-arm64 • Android 9 (API 28)

• No issues found!

I think this issue could be resolved by upgrading the gradle version of this plugin.

miguelpruivo commented 4 years ago

Check this solution.

monisnap-julien commented 4 years ago

Check this solution.

Hello and thank you for your quick answer. However I don't think that a downgrade is the right solution since any other of my external libraries are working fine using gradle 4. Isn't there any other option ?

miguelpruivo commented 4 years ago

Try updating your gradle to 4.0.1 and also I suggest you to make sure your app is fully android X compatible. Sometimes there are bad migrations that could result on this, specially on old projects.

monisnap-julien commented 4 years ago

Try updating your gradle to 4.0.1 and also I suggest you to make sure your app is fully android X compatible. Sometimes there are bad migrations that could result on this, specially on old projects.

Thank you for the answer. Do you know any tool or documentation that could help me to know if my app is fully compatible ? I did the migration a long time ago and I thought everything was ok but I couldn't tell for sure.

miguelpruivo commented 4 years ago

Sure, you can check it here @monisnap-julien.

Feel free to reopen the issue if you still experience any problem related to this.

easazade commented 4 years ago

I'm facing this problem as well. how did you solve it? @monisnap-julien.

monisnap-julien commented 4 years ago

I'm facing this problem as well. how did you solve it? @monisnap-julien.

I've downgraded gradle for now, and it worked.