Issue
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
Solution
Solution is described in this article. https://medium.com/flutterpub/flutter-app-couldnt-find-libflutter-so-c95ad81cbccd
TL;DR;
In build.gradle of app this lines should be added:
android {
...
defaultConfig {
....
ndk {
abiFilters 'armeabi-v7a'
}
}
Build should be made using flutter build apk
Answered By - Александр Бабич
Answer Checked By - Clifford M. (JavaFixing Volunteer)