Android Studio: UnsatisfiedLinkError: dlopen failed: /lib/arm/libuvcNative.so: has text relocations
Android Studio: UnsatisfiedLinkError: dlopen failed: /lib/arm/libuvcNative.so: has text relocations
我的 AndroidStudio 项目构建良好,但是当我调用 activity 并从 SDK 创建 MediaManager 对象时,我 运行 遇到此错误:
07-06 20:35:18.520 6521-6521/de.sanbot.sanbotapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.sanbot.sanbotapp, PID: 6521
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/de.sanbot.sanbotapp-1/base.apk"],nativeLibraryDirectories=[/data/app/de.sanbot.sanbotapp-1/lib/arm, /data/app/de.sanbot.sanbotapp-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libuvcNative.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.qihancloud.opensdk.function.unit.MediaManager.<clinit>(MediaManager.java:77)
at com.qihancloud.opensdk.base.BindBaseActivity.getUnitManager(BindBaseActivity.java:674)
这是我的 build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "de.sanbot.sanbotapp"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation(name: 'QihanOpenSDK_1.1.8.0', ext: 'aar')
implementation 'com.skype.android.skype-android-sdk:MobileSdk:1.0.0.0'
implementation 'org.tensorflow:tensorflow-android:1.6.0'
implementation 'com.jakewharton:butterknife:8.5.1'
implementation files('libs/gson-2.2.4.jar')
}
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
我发现了 个问题,但我不想添加另一个库。而这个人有不同的错误。如果我添加 abiFilter(按照建议)
android {
...
defaultConfig {
...
ndk {
abiFilters 'armeabi'
}
}
}
我得到一个不同的错误:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.sanbot.sanbotapp, PID: 12237
java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/de.sanbot.sanbotapp-1/lib/arm/libuvcNative.so: has text relocations
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at com.qihancloud.opensdk.function.unit.MediaManager.<clinit>(MediaManager.java:77)
at com.qihancloud.opensdk.base.BindBaseActivity.getUnitManager(BindBaseActivity.java:674)
任何提示都会对我有很大帮助!
更新:
that是我要走的方向吗?
通过将 targetSdkVersion 从 26
更改为 22
解决了这个问题。不确定这是否是正确的方法,但它成功了。
新建build.gradle
文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "de.sanbot.sanbotapp"
minSdkVersion 23
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
...
我的 AndroidStudio 项目构建良好,但是当我调用 activity 并从 SDK 创建 MediaManager 对象时,我 运行 遇到此错误:
07-06 20:35:18.520 6521-6521/de.sanbot.sanbotapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.sanbot.sanbotapp, PID: 6521
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/de.sanbot.sanbotapp-1/base.apk"],nativeLibraryDirectories=[/data/app/de.sanbot.sanbotapp-1/lib/arm, /data/app/de.sanbot.sanbotapp-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libuvcNative.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.qihancloud.opensdk.function.unit.MediaManager.<clinit>(MediaManager.java:77)
at com.qihancloud.opensdk.base.BindBaseActivity.getUnitManager(BindBaseActivity.java:674)
这是我的 build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "de.sanbot.sanbotapp"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation(name: 'QihanOpenSDK_1.1.8.0', ext: 'aar')
implementation 'com.skype.android.skype-android-sdk:MobileSdk:1.0.0.0'
implementation 'org.tensorflow:tensorflow-android:1.6.0'
implementation 'com.jakewharton:butterknife:8.5.1'
implementation files('libs/gson-2.2.4.jar')
}
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
我发现了
android {
...
defaultConfig {
...
ndk {
abiFilters 'armeabi'
}
}
}
我得到一个不同的错误:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.sanbot.sanbotapp, PID: 12237
java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/de.sanbot.sanbotapp-1/lib/arm/libuvcNative.so: has text relocations
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at com.qihancloud.opensdk.function.unit.MediaManager.<clinit>(MediaManager.java:77)
at com.qihancloud.opensdk.base.BindBaseActivity.getUnitManager(BindBaseActivity.java:674)
任何提示都会对我有很大帮助!
更新:
that是我要走的方向吗?
通过将 targetSdkVersion 从 26
更改为 22
解决了这个问题。不确定这是否是正确的方法,但它成功了。
新建build.gradle
文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "de.sanbot.sanbotapp"
minSdkVersion 23
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
...