Gobi
Gobi

Reputation: 83

Release APK Crash in flutter

flutter run --release -->>

Flutter run key commands. h Repeat this help message. c Clear the screen q Quit (terminate the application on the device). E/AndroidRuntime(14424): FATAL EXCEPTION: main E/AndroidRuntime(14424): Process: com.gioexchange.app, PID: 14424 E/AndroidRuntime(14424): java.lang.NoClassDefFoundError: Failed resolution of: Lio/flutter/plugins/imagepicker/ImagePickerPlugin$LifeCycleObserver; E/AndroidRuntime(14424): at io.flutter.plugins.imagepicker.ImagePickerPlugin.c(Unknown Source:22) E/AndroidRuntime(14424): at io.flutter.plugins.imagepicker.ImagePickerPlugin.d(Unknown Source:27) E/AndroidRuntime(14424): at io.flutter.embedding.engine.c.h(Unknown Source:106) E/AndroidRuntime(14424): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(Unknown Source:71) E/AndroidRuntime(14424): at com.gioexchange.app.MainActivity.k(Unknown Source:5) E/AndroidRuntime(14424): at io.flutter.embedding.android.i.k(Unknown Source:10) E/AndroidRuntime(14424): at io.flutter.embedding.android.e.k(Unknown Source:58) E/AndroidRuntime(14424): at io.flutter.embedding.android.i.u0(Unknown Source:10) E/AndroidRuntime(14424): at androidx.fragment.app.Fragment.Z0(Unknown Source:21) E/AndroidRuntime(14424): at androidx.fragment.app.j.R0(Unknown Source:433) E/AndroidRuntime(14424): at androidx.fragment.app.o.b(Unknown Source:206) E/AndroidRuntime(14424): at androidx.fragment.app.o.c(Unknown Source:18) E/AndroidRuntime(14424): at androidx.fragment.app.o.C(Unknown Source:36) E/AndroidRuntime(14424): at androidx.fragment.app.j.n0(Unknown Source:110) E/AndroidRuntime(14424): at androidx.fragment.app.j.Z0(Unknown Source:88) E/AndroidRuntime(14424): at androidx.fragment.app.j.l0(Unknown Source:21) E/AndroidRuntime(14424): at androidx.fragment.app.j.e0(Unknown Source:9) E/AndroidRuntime(14424): at androidx.fragment.app.j.y(Unknown Source:6) E/AndroidRuntime(14424): at androidx.fragment.app.f.c(Unknown Source:4) E/AndroidRuntime(14424): at androidx.fragment.app.d.onStart(Unknown Source:15) E/AndroidRuntime(14424): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1334) E/AndroidRuntime(14424): at android.app.Activity.performStart(Activity.java:7033) E/AndroidRuntime(14424): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2793) E/AndroidRuntime(14424): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2905) E/AndroidRuntime(14424): at android.app.ActivityThread.-wrap11(Unknown Source:0) E/AndroidRuntime(14424): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1606) E/AndroidRuntime(14424): at android.os.Handler.dispatchMessage(Handler.java:105) E/AndroidRuntime(14424): at android.os.Looper.loop(Looper.java:169) E/AndroidRuntime(14424): at android.app.ActivityThread.main(ActivityThread.java:6595) E/AndroidRuntime(14424): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(14424): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) E/AndroidRuntime(14424): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) E/AndroidRuntime(14424): Caused by: java.lang.ClassNotFoundException: io.flutter.plugins.imagepicker.ImagePickerPlugin$LifeCycleObserver E/AndroidRuntime(14424): at java.lang.VMClassLoader.findLoadedClass(Native Method) E/AndroidRuntime(14424): at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738) E/AndroidRuntime(14424): at java.lang.ClassLoader.loadClass(ClassLoader.java:363) E/AndroidRuntime(14424): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/AndroidRuntime(14424): ... 32 more E/AndroidRuntime(14424): Caused by: java.lang.IllegalAccessError: Interface androidx.lifecycle.b implemented by class io.flutter.plugins.imagepicker.ImagePickerPlugin$LifeCycleObserver is inaccessible (declaration of 'io.flutter.plugins.imagepicker.ImagePickerPlugin$LifeCycleObserver' appears in /data/app/com.gioexchange.app-m19xWFnw-h0Vo8t5Dxn8tw==/base.apk) E/AndroidRuntime(14424): ... 32 more

Upvotes: 0

Views: 1938

Answers (1)

Mahesh Jamdade
Mahesh Jamdade

Reputation: 20221

I tried a couple of things mentioned in this issue

  1. Add lintOptions to app/build.gradle
lintOptions {
    checkReleaseBuilds false
}

If this still doesn't work then

  1. check the gradle version in app/build.gradle I was using 4.0.0 so I downgraded it to 3.6.2
 classpath 'com.android.tools.build:gradle:3.6.2'
  1. Lastly another alternative would be to add this plugin flutter_plugin_android_lifecycle: ^2.0.1 to your pubspec.yaml file .

Then rebuild the project and build the release apk.

Upvotes: 1

Related Questions