Process: com.online.bysmart, PID: 14766
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.online.bysmart-2/base.apk"],nativeLibraryDirectories=[/data/app/com.online.bysmart-2/lib/arm64, /system/lib64, /vendor/lib64]]] couldn't find "libmiio.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:984)
at java.lang.System.loadLibrary(System.java:1530)
at com.xiaomi.miio.JNIBridge.<clinit>(JNIBridge.java:6)
at com.xiaomi.miio.JNIBridge.hencrypt(Native Method)
at com.xiaomi.miio.MiioLocalAPI.get_token(MiioLocalAPI.java:779)
at com.xiaomi.miio.MiioLocalAPI$13.run(MiioLocalAPI.java:761)
at java.lang.Thread.run(Thread.java:760)
================================================ ========================= 在我的应用程序build.gradle文件中:
dependencies {
compile fileTree(include:['*.jar'], dir: 'libs')
compile files('libs/miio.jar')
...
}
splits {
abi {
enable true
reset()
include 'armeabi' ,'armeabi-v7a','arm64-v8a', 'x86'
universalApk false
}
}
sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDirs = ['libs']
}
}
buildTypes {
release {
minifyEnabled true
zipAlignEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
================================================ ========================= 在根libs目录文件中:
--libs
--arm64-v8a//folder name
--libmiio.so//file
--miio.jar//file
================================================ ========================= 在proguard-rules.pro中:
-dontwarn com.xiaomi.**
-keep class com.xiaomi.**{*;}
-keep interface com.xiaomi.** { *;}
答案 0 :(得分:0)
这些天我在网上搜索,终于找到了解决方案! 如果您使用的是Android Studio,只需在根文件夹中编辑gradle.properties并添加android.useDeprecatedNdk = true。然后在您应用的文件夹中编辑build.gradle文件,如下所示设置abiFilters:
android {
....
defaultConfig {
....
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
}
有关更多信息,您可以在stackoverflow上看到How to use 32-bit native libaries on 64-bit Android device,how to use 32bit native libraries on 64 bit Android-L platform。
您也可以选中此Post。
答案 1 :(得分:0)
找到了根本原因,因为我的应用程序build.gradle配置是
splits {
abi {
enable true
reset()
include 'armeabi' ,'armeabi-v7a','arm64-v8a'
universalApk false
}
}
但是在我的libs文件夹中,我没有配置armeabi文件夹