我在 Windows 10(64 位)上使用 Android Studio 3.3 版。以下是发生错误的虚拟设备的特征:
- Nexus 5X API 28,Android 9.0,CPU/ABI:x86
- Nexus 5X API 28,Android 9.0,CPU/ABI:x86_64
- Nexus 5 API 24,Android 7.0,CPU/ABI:x86
- 像素 API 27,Android 8.1,CPU/ABI:x86
Movesense 移动库版本:1.28.1。
我从 Movesense 网站 ( https://bitbucket.org/suunto/movesense-mobile-lib/downloads/ )下载了文件夹 suunto-movesense-mobile-lib-e78baa174a4a,并尝试为 Android 运行各种示例。我要展示的问题记录在 ECGSample 中,但其他三个也出现了。该应用程序已正确构建,但是当我在虚拟设备上运行该应用程序时,出现以下错误:
安装失败并显示消息 Failed to finalize session:
INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
(更改 Android 设备和 API 版本,出现同样的错误)。我解决了这个问题,将它添加到我的模块的 build.gradle 脚本里面 Android{} 块:
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
完成此操作后,应用程序在虚拟设备上启动,但不幸的是立即崩溃。应用程序正确启动但立即关闭并显示以下消息:
" Movesense ECG sample keeps stopping".
通过检查 Logcat 我有以下错误:
2019-02-08 12:03:28.641 4770-4770/com.movesense.samples.ecgsampleE/AndroidRuntime: FATAL EXCEPTION: main
Process: com.movesense.samples.ecgsample,PID: 4770
java.lang.UnsatisfiedLinkError:No implementation found for void com.movesense.mds.SDSInternalWrapper.sdsSetDelegate(java.lang.Object)(tried Java_com_movesense_mds_SDSInternalWrapper_sdsSetDelegate and Java_com_movesense_mds_SDSInternalWrapper_sdsSetDelegate__Ljava_lang_Object_2)
at com.movesense.mds.SDSInternalWrapper.sdsSetDelegate(NativeMethod)
at com.movesense.mds.SDSInternalWrapper.setDelegate(SDSInternalWrapper.java:167)
at com.movesense.mds.internal.operation.MdsOperationHandler.<init>(MdsOperationHandler.java:87)
at com.movesense.mds.Mds$Builder.build(Mds.java:357)
at com.movesense.samples.ecgsample.MainActivity.initMds(MainActivity.java:85)
at com.movesense.samples.ecgsample.MainActivity.onCreate(MainActivity.java:70)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(NativeMethod)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
为了抓住真正的问题,我们调试程序,它得到一个错误,错误是“找不到“libmds.so”。细节:
System.loadLibrary(mds) FAILED! Error: sds: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/base.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_resources_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.movesense.samples.ecgsample-gmciklKIfxkuippl92JJAQ==/lib/x86, /system/lib]]] couldn't find "libmds.so"
发生错误的代码。
private native void sdsSetDelegate(Object var1);
static {
try {
Log.d("SDSInternalWrapper", "Start load library call [mds]");
System.loadLibrary("mds"); (Error occurred)
Log.d("SDSInternalWrapper", "Finished load library call [mds]");
} catch (UnsatisfiedLinkError var2) {
String error = String.format("System.loadLibrary(mds) FAILED! Error: sds: %s", var2);
Log.e("SDSInternalWrapper", error);
}
}