Flutter Release 应用程序在启动时崩溃:找不到 libflutter.so

Posted

技术标签:

【中文标题】Flutter Release 应用程序在启动时崩溃:找不到 libflutter.so【英文标题】:Flutter Release app crash on startup: libflutter.so not found 【发布时间】:2020-11-30 10:35:17 【问题描述】:

这仍然在 Flutter v1.20.1 中发生。发布版本在 2 或 3 天前运行良好。这只是凭空发生的。调试变体没有问题,但发布变体根本没有启动。

[√] Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version 10.0.18362.959], locale en-US)
• Flutter version 1.20.1 at C:\flutter
• Framework revision 2ae3451 (5 days ago), 2020-08-05 19:53:19 -0700
• Engine revision c8e3b94853
• Dart version 2.9.0

[√] android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\Sepehr\AppData\Local\Android\Sdk
• Platform android-29, build-tools 28.0.3
• ANDROID_HOME = C:\Users\Sepehr\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.

[!] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[!] IntelliJ IDEA Community Edition (version 2019.2)
• IntelliJ at E:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2.4
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins

[√] VS Code (version 1.47.3)
• VS Code at C:\Users\Sepehr\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.13.2

[√] VS Code, 64-bit edition (version 1.33.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.13.2

[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.0.0 (API 26) (emulator)

这是来自 android studio 的错误:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.moshaveron.app, PID: 26315
    java.lang.RuntimeException: Unable to start activity ComponentInfocom.moshaveron.app/com.example.moshaveron.MainActivity: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/lib/x86, /data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/base.apk!/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libflutter.so"
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6541)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
     Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/lib/x86, /data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/base.apk!/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libflutter.so"
        at io.flutter.embedding.engine.loader.FlutterLoader.ensureInitializationComplete(Unknown Source:246)
        at io.flutter.embedding.engine.FlutterEngine.<init>(Unknown Source:150)
        at io.flutter.embedding.engine.FlutterEngine.<init>(Unknown Source:19)
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.setupFlutterEngine(Unknown Source:110)
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(Unknown Source:7)
        at io.flutter.embedding.android.FlutterActivity.onCreate(Unknown Source:22)
        at android.app.Activity.performCreate(Activity.java:6975)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
        at android.os.Handler.dispatchMessage(Handler.java:105) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6541) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
     Caused by: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/lib/x86, /data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/base.apk!/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libflutter.so"
        at java.util.concurrent.FutureTask.report(FutureTask.java:123)
        at java.util.concurrent.FutureTask.get(FutureTask.java:193)
        at io.flutter.embedding.engine.loader.FlutterLoader.ensureInitializationComplete(Unknown Source:23)
        at io.flutter.embedding.engine.FlutterEngine.<init>(Unknown Source:150) 
        at io.flutter.embedding.engine.FlutterEngine.<init>(Unknown Source:19) 
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.setupFlutterEngine(Unknown Source:110) 
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(Unknown Source:7) 
        at io.flutter.embedding.android.FlutterActivity.onCreate(Unknown Source:22) 
        at android.app.Activity.performCreate(Activity.java:6975) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
        at android.os.Handler.dispatchMessage(Handler.java:105) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6541) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
     Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/lib/x86, /data/app/com.moshaveron.app-5pAD9es955nc0lR2SqLCkQ==/base.apk!/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libflutter.so"
        at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
        at java.lang.System.loadLibrary(System.java:1657)
        at io.flutter.embedding.engine.loader.FlutterLoader$1.call(Unknown Source:10)
        at io.flutter.embedding.engine.loader.FlutterLoader$1.call(Unknown Source:0)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2020-08-10 23:45:50.092 26315-26315/? E/AndroidRuntime:     at java.lang.Thread.run(Thread.java:764)
2020-08-10 23:45:50.101 1679-7140/? W/ActivityManager:   Force finishing activity com.moshaveron.app/com.example.moshaveron.MainActivity

这是我所有插件的列表:

cupertino_icons: ^0.1.3
provider: ^4.1.3
shared_preferences: ^0.5.6
animations: ^1.1.1
flutter_svg: ^0.17.4
page_indicator: ^0.3.0
pin_code_fields: ^3.1.2
shimmer: ^1.1.1
carousel_slider: ^2.2.1
like_button: ^1.0.1
flutter_picker: ^1.1.5
image_picker: ^0.6.7+4
image_cropper: ^1.2.3
path_provider: ^1.6.11
file_picker: ^1.12.0
dio: ^3.0.9
connectivity: ^0.4.9
transparent_image: ^1.0.0
rxdart: ^0.24.1
string_validator: ^0.1.4
package_info: ^0.4.1
url_launcher: ^5.5.0
cached_network_image: ^2.2.0+1
sliding_up_panel: ^1.0.2
intl: ^0.16.1
simple_animations: ^2.2.1
video_player: ^0.10.11+2
flutter_colorpicker: ^0.3.4
font_awesome_flutter: ^8.8.1
random_color: ^1.0.5
http: ^0.12.2
socket_io_client: ^0.9.11
flutter_webrtc: ^0.2.8
fluttertoast: ^7.0.2

【问题讨论】:

你清理你的项目和构建文件了吗? 我清理了它。我试图从头开始重新制作我的项目。我添加了 abiFilters 'x86'、'x86_64'、'armeabi'、'armeabi-v7a'、'mips'、'mips64'、'arm64-v8a'。我什至用 --split-per-abi 标志构建。我试图用android studio签署apk然后安装它。那也没有用。我多次更改了颤振的版本。改为master beta稳定频道。他们都没有解决这个问题。我打开了胖 apk,很奇怪 libflutter.so 就在正确的文件夹中,但是 android 不能把它捡起来? 对不起,我真的不知道颤振,所以我不能帮助你更多。只是认为这可能会有所帮助,因为我遇到了通过项目重建解决的类似问题。 这也是我面临的问题。 【参考方案1】:

问题是flutter_webrtc。 我删除了它,一切都恢复正常了。

【讨论】:

你能解释清楚吗?

以上是关于Flutter Release 应用程序在启动时崩溃:找不到 libflutter.so的主要内容,如果未能解决你的问题,请参考以下文章

Flutter和iOS混合开发iOS14启动闪退

在 iOS 模拟器上以发布模式 Flutter 启动应用程序时出现问题

Flutter 应用程序无法在 apk-release 中运行,但可以在调试模式下运行(即使在授予 Internet 权限后)

Flutter Application release apk 在真实设备上无法正常工作

API 在“flutter run --release”模式下不起作用 [重复]

转:Flutter开发中踩过的坑