android
runtime_error
ai_generated
true
java.lang.UnsatisfiedLinkError: dlopen failed: library "libmylib.so" not found
ID: android/unsatisfiedlinkerror-native-lib-not-found
80%Fix Rate
85%Confidence
1Evidence
2023-06-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Android 12 (API 31) | active | — | — | — |
| Android 13 (API 33) | active | — | — | — |
| Android 14 (API 34) | active | — | — | — |
| NDK r26c | active | — | — | — |
| Gradle 8.2 | active | — | — | — |
Root Cause
Native library (.so) is missing for the device's ABI, not bundled in APK, or loaded from wrong path.
generic中文
原生库 (.so) 缺少设备 ABI 对应的版本,未打包到 APK 中,或从错误路径加载。
Official Documentation
https://developer.android.com/ndk/guides/abisWorkarounds
-
90% success Place the correct .so file for each target ABI under app/src/main/jniLibs/<abi>/libmylib.so. For example: arm64-v8a, armeabi-v7a, x86_64. Then rebuild.
Place the correct .so file for each target ABI under app/src/main/jniLibs/<abi>/libmylib.so. For example: arm64-v8a, armeabi-v7a, x86_64. Then rebuild.
-
75% success In build.gradle (app level), add a packaging block to exclude unused ABIs: android { packagingOptions { jniLibs { useLegacyPackaging = true } } }
In build.gradle (app level), add a packaging block to exclude unused ABIs: android { packagingOptions { jniLibs { useLegacyPackaging = true } } } -
80% success If using a third-party SDK, verify the SDK version supports your target ABI and update the dependency. For example, if using OpenCV, ensure you include the correct ABI in the SDK distribution.
If using a third-party SDK, verify the SDK version supports your target ABI and update the dependency. For example, if using OpenCV, ensure you include the correct ABI in the SDK distribution.
中文步骤
Place the correct .so file for each target ABI under app/src/main/jniLibs/<abi>/libmylib.so. For example: arm64-v8a, armeabi-v7a, x86_64. Then rebuild.
In build.gradle (app level), add a packaging block to exclude unused ABIs: android { packagingOptions { jniLibs { useLegacyPackaging = true } } }If using a third-party SDK, verify the SDK version supports your target ABI and update the dependency. For example, if using OpenCV, ensure you include the correct ABI in the SDK distribution.
Dead Ends
Common approaches that don't work:
-
70% fail
Cleaning the project and rebuilding often fails because the root cause (missing ABI folder in jniLibs) persists.
-
85% fail
Adding a random .so file from another project doesn't match the expected native API, causing different crashes.
-
60% fail
Enabling minification (ProGuard/R8) may strip native libraries if not properly configured, making the error worse.