Alex Aung
Alex Aung

Reputation: 3159

Fatal Exception: java.lang.RuntimeException: Unable to start activity ... ... couldn't find "libflutter.so"

I found a lot of this issue in production and still could not solved.

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.thitsarparami.app/com.ryanheise.audioservice.AudioServiceActivity}: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.thitsarparami.app-a-dcbjkGZG7bhB8y1Z4zZw==/base.apk"],nativeLibraryDirectories=[/data/app/org.thitsarparami.app-a-dcbjkGZG7bhB8y1Z4zZw==/lib/arm64, /system/lib64, /hw_product/lib64, /system/product/lib64]]] couldn't find "libflutter.so"
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3897)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4076)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2473)
       at android.os.Handler.dispatchMessage(Handler.java:110)
       at android.os.Looper.loop(Looper.java:219)
       at android.app.ActivityThread.main(ActivityThread.java:8349)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)

Device specifications Model name Pixel 2 (virtual) Manufacturer Google Android version Android 9 (SDK 28) Locale th_TH Screen size 1080 x 1920 Screen density (DPI) 441 RAM (total memory)

OpenGL ES version

ABI armeabi CPU

flutter doctor

[✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-x64, locale en-GB) • Flutter version 3.0.5 at /Users/aungmyooo/Development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f1875d570e (5 days ago), 2022-07-13 11:24:16 -0700 • Engine revision e85ea0e79c • Dart version 2.17.6 • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/aungmyooo/Library/Android/sdk • Platform android-33, build-tools 31.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.69.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.44.0

[✓] Connected device (3 available) • iPhone (mobile) • 06e02964e429eeebf29550b03ef955abe09891ef • ios • iOS 15.5 19F77 • macOS (desktop) • macos • darwin-x64 • macOS 12.4 21F79 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.114

[✓] HTTP Host Availability • All required HTTP hosts are available

Upvotes: 7

Views: 3878

Answers (1)

paulsm4
paulsm4

Reputation: 121809

This is the salient part of the error message:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ... 
... couldn't find "libflutter.so"

This appears to be a build-time issue.

It's been reported multiple different times over multiple different versions. I see several "workarounds" ... but no "fix".

Specifically:

https://github.com/flutter/flutter/issues/32756

Seems like uninstalling the app and reinstalling fixed it, error occured without changing anything in the code, just opened up Android studio again and pressed the run button...

See also:

https://stackoverflow.com/a/65032771/421195

Flutter does not currently support building for x86 Android (See Issue 9253).

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

buildTypes {
    release {
        ndk {
            abiFilters 'armeabi-v7a','arm64-v8a','x86_64'
        }
    }
}

... and ...

https://stackoverflow.com/a/69998842/421195

In app level build.gradle following line should be added

defaultConfig {
    ...
    ndk { abiFilters "armeabi", "x86", "armeabi-v7a","x86_64", "mips", 
     "mips64", "arm64-v8a" }
}

SUGGESTION: Review the threads, post back and let us know if any of the suggestions worked for you.

Upvotes: 2

Related Questions