Flutter App working debug mode, in release app not working
Solution 1
This worked for me.
Go to build.gradle
file at android/gradle
and downgrade to version 3.6.2 like shown below,
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
Answer taken from this thread.
Solution 2
I had similar issue, its related to gradle 4+ version i guess, i was able to resolve this by following below steps.
Add bellow line to app/proguard-rules.pro (if file not present create one.)
-keep class androidx.lifecycle.DefaultLifecycleObserver
Error from logcat, it was only having issue in release build. The emulator was working fine. -
03-12 07:41:32.281 22847 22847 E AndroidRuntime: 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)
Related Discussion/Issue can be found here -https://github.com/flutter/flutter/issues/58479
Abdul Kadhar
Updated on December 25, 2022Comments
-
Abdul Kadhar over 1 year
When i run flutter run --release -v this command below error came
Caused by: 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 /data/app/app.projects.xxx.mobile-1/base.apk)
My Gradle is classpath 'com.android.tools.build:gradle:4.0.0' //4.0.1 //3.3.2 //3.5.3 //3.4.2
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip