Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter app drops java.lang.UnsatisfiedLinkError (couldn't find "libflutter.so")

I've built an app written on Flutter and it's running well on my device.

On client device however it is crashing at start (even before Centry initiates).

When connected To ADB we got this log:

 AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.travel.exchange-1/base.apk"],nativeLibraryDirectories=[/data/app/com.travel.exchange-1/lib/arm, /data/app/com.travel.exchange-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libflutter.so"

 at java.lang.Runtime.loadLibrary (Runtime.java:367)
  at java.lang.System.loadLibrary (System.java:1076)
  at io.flutter.view.FlutterMain.startInitialization (FlutterMain.java:172)
  at io.flutter.view.FlutterMain.startInitialization (FlutterMain.java:149)
  at io.flutter.app.FlutterApplication.onCreate (FlutterApplication.java:22)
  at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1037)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6496)
  at android.app.ActivityThread.access$1800 (ActivityThread.java:229)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1887)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:148)
  at android.app.ActivityThread.main (ActivityThread.java:7406)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

I'm building specifically using arm64 (app crashes even on my device if I'm trying to run on arm (32).

flutter build apk --release --target-platform=android-arm64
like image 310
Александр Бабич Avatar asked Oct 13 '18 17:10

Александр Бабич


1 Answers

added following code under the buildTypes in android\app\build.gradle

buildTypes {
    release {
        ndk {
            abiFilters 'armeabi-v7a','arm64-v8a','x86_64'
        }
    }
}
like image 104
Deshani Ranasingha Avatar answered Sep 19 '22 14:09

Deshani Ranasingha