文章目录
一、报错信息
二、修改方案
一、报错信息
应用运行时报错 :
2021-11-19 16:22:58.014 13244-13244/com.example E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example, PID: 13244 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.example-5snWC60wIs8cUjw0BF99qg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example-5snWC60wIs8cUjw0BF99qg==/lib/arm64, /data/app/com.example-5snWC60wIs8cUjw0BF99qg==/base.apk!/lib/arm64-v8a, /system/lib64]]] couldn't find "libmp3lame.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1012) at java.lang.System.loadLibrary(System.java:1669) at com.buihha.audiorecorder.Mp3Recorder.<clinit>(Mp3Recorder.java:19) at com.example.base.MainActivity.start(MainActivity.java:304) at com.example.base.MainActivity.control(MainActivity.java:163) at com.example.base.MainActivity_ViewBinding$1.doClick(MainActivity_ViewBinding.java:42) at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22) at android.view.View.performClick(View.java:6597) at android.view.View.performClickInternal(View.java:6574) at android.view.View.access$3100(View.java:778) at android.view.View$PerformClick.run(View.java:25885) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6718) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
二、修改方案
Java 中加载动态库时 , 由于在应用中没有配置对应动态库信息 , 报上述错误 ;
在 build.gradle 配置文件中配置导入的第三方动态库目录 ;
android { sourceSets { main { jniLibs.srcDirs = ['libs'] } } }
然后将动态库拷贝到 libs 目录下 , 推荐为 4 44 种 CPU 架构都准备一个动态库 ;