安卓原生接入Flutter -- couldn‘t find “libflutter.so“

一、报错日志

 java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.xiaoban.driver-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xiaoban.driver-1/lib/arm, /data/app/com.xiaoban.driver-1/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]] couldn't find "libflutter.so"
        at java.util.concurrent.FutureTask.report(FutureTask.java:94)
        at java.util.concurrent.FutureTask.get(FutureTask.java:164)
        at io.flutter.embedding.engine.loader.FlutterLoader.ensureInitializationComplete(FlutterLoader.java:193)
        at io.flutter.embedding.engine.FlutterEngine.(FlutterEngine.java:284)
        at io.flutter.embedding.engine.FlutterEngine.(FlutterEngine.java:190)
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.setupFlutterEngine(FlutterActivityAndFragmentDelegate.java:233)
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:153)
        at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:411)
        at com.xiaoban.driver.v3.ui.ActivityFlutter.onCreate(ActivityFlutter.java:69)
        at android.app.Activity.performCreate(Activity.java:6858)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2710)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2818)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:163)
        at android.app.ActivityThread.main(ActivityThread.java:6393)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)

二、错误原因

   couldn't find "libflutter.so"

   安卓原生设置 armeabi 下面 so库。但是Flutter没有armeabi下面的so库造成找不到libflutter.so崩溃。

ndk {
    abiFilters 'armeabi'
}

 

三、解决办法

1、修改 原生项目 so库包为armeabi-v7a

2、设置 项目使用 armeabi-v7a 包。 

ndk {
    abiFilters 'armeabi-v7a'
}

 

 

你可能感兴趣的:(Flutter,android,Flutter)