“Movesense ECG 样本不断停止”和错误“找不到 "libmds.so"

" Movesense ECG sample keeps stopping" and error “couldn't find "libmds.so"

我在 Windows 10(64 位)上使用 Android Studio 3.3 版。以下是发生错误的虚拟设备的特征:

Movesense移动图书馆版本:1.28.1.

我从 Movesense 网站 (https://bitbucket.org/suunto/movesense-mobile-lib/downloads/) 下载了 suunto-movesense-mobile-lib-e78baa174a4a 文件夹,并尝试 运行 Android 的各种样本。我要展示的问题已记录在 ECGSample 中,但其他三个也出现过。 应用程序构建正确,但是当我 运行 虚拟设备上的应用程序时出现以下错误:

安装失败并显示消息未能完成会话:

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);
    }

}

在展示应用程序的 build.gradle 中,mdslib-.aar 库应位于 Movesense 文件夹中,该文件夹相对于项目位于“../Movesense/”,或者如果您正在尝试其他示例它应该位于“../../../Movesense/”,你把它放在那里了吗?

如果不是,请尝试保持此处的文件夹结构https://bitbucket.org/suunto/movesense-mobile-lib/src/master/android/

|_Movesense/ 
| |_libmds-<version>.aar
|  
|_Showcasapp/
| |_gradle/
| |_src/
| |
| 
|_Samples/

当前的 MDS 不支持 x86 或 x64,这就是您收到 UnsatisfiedLinkError 的原因。因此暂时无法与Android模拟器一起使用,只能在设备上调试。

完全免责声明:我为 Movesense 团队工作