I'm developing an Android application which will use Myo armband. I want to implement it as an accessibility service, so that gestured detected by the armband could, e.g. navigate home etc.
I'm trying to initialize the hub, but the app stops with the following error stack:
01-06 23:42:41.222 11979-11979/eu.miko.myoid E/AndroidRuntime: FATAL EXCEPTION: main
Process: eu.miko.myoid, PID: 11979
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/eu.miko.myoid-1/base.apk"],nativeLibraryDirectories=[/data/app/eu.miko.myoid-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libgesture-classifier.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.thalmic.myo.scanner.Scanner.<clinit>(Scanner.java:31)
at com.thalmic.myo.Hub.init(Hub.java:201)
at eu.miko.myoid.MyoidAccessibilityService.onCreate(MyoidAccessibilityService.java:21)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2877)
at android.app.ActivityThread.-wrap4(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1427)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
This is the code I use for hub initialization, as per Myo documentation. I've tried putting it in both the onCreate and onServiceConnected methods of the accessibility service, the error comes up anyhow.
Hub hub = Hub.getInstance();
if (hub.init(this, getPackageName())) {
Intent intent = new Intent(this, ScanActivity.class);
startActivity(intent);
hub.setLockingPolicy(Hub.LockingPolicy.NONE);
hub.addListener(mListener);
}
else {
Log.e(TAG, "Could not initialize the Hub.");
}
I'm using the most recent Myo Android SDK. Testing on Nexus 5 with most recent firmware.
To me it seems like an error inside of the SDK, but perhaps it's something to do with my configuration? Any help would be appreciated.
The samples given in the SDK don't seem to suffer from the same issue though.
In theory, the libgesture-classifier.so file is added, through the following:
I'm including the Myo SDK in the project through the build.gradle file:
dependencies {
...
repositories {
maven {
// this must point to the myorepository distributed with the Myo SDK
url '../myorepository'
}
}
compile('com.thalmic:myosdk:0.10.+@aar')
}
The myorepository contains myosdk-0.10.0.aar.
Which, when I examine it as a zip, contains libs/native-libs.jar
Which, in turn when examined as a zip, contains , each of which contains the single file libgesture-classifier.so
I could resolve the issue by switching back to an earlier version of the gradle plugin for Android. There seems to be a problem with the native libraries within the myosdk, they do not get copied correctly.
Simply edit the build.gradle file from the project. Version 1.3.0 worked for me.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
**classpath 'com.android.tools.build:gradle:1.3.0'**
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With