- 具体错误
/AndroidRuntime: FATAL EXCEPTION: BaseActivity
Process: com.serenegiant.usbcameratest, PID: 5494
java.lang.UnsatisfiedLinkError: dlopen failed: library "libjpeg-turbo1500.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at com.serenegiant.usb.UVCCamera.<clinit>(UVCCamera.java:119)
at com.serenegiant.usbcameratest.MainActivity$2$1.run(MainActivity.java:143)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.os.HandlerThread.run(HandlerThread.java:67)
- 原因分析
这种情形一般出现于:app依赖于某个jni项目。你以为jni项目编译过了,app依赖也正确,就可以把so打包到apk?图样图森破。
- 解决办法
首先在app目录中,搜索so的位置,一般应该是lib。
然后在build.gradle中配置:
android {
......
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}