Muse SDK for Android Released!


#1

Hey there Muse developers,

Good news!

We’ve just released a major update to the Muse SDK (3.4.0): a native Muse library for Android, LibMuse. Now you can connect directly to Muse via Bluetooth on your Android device and obtain raw EEG data, relative and absolute band powers, blinks, jaw clenches, and much more right in your custom application.

If you’ve been waiting to build an all-in-one Muse app on Android, or to integrate Muse with your existing Android app, now you can.

[SIZE=22px]Download it here[/SIZE]

The documentation for LibMuse is generated by Doxygen and can be browsed from /doc/index.html in the top-level libMuse directory or at android.choosemuse.com.

We can’t wait to see what you build with Muse!


#2

I seem to be going in circles looking for the Android SDK download files.

“Download it here” in this post takes me to the “Download & Install” page.

On that page there are direct file links for Windows, Mac, and Linux. In the next section there is the “LibMuse” link next to text about Android support.

The “LibMuse” page has two links to “Getting Started with Android Development”.

Step 2 on the “Getting Started” page is a link back to the “Download & Install” page above.

etc.

Looking forward to working with the SDK though!


#3

Hi Puzzlebox,

LibMuse for Android is a compressed (zip) file inside the latest release of Muse SKD (3.4.0), you need to download the full SDK again (Muse-io, Muse-Player and MuseLab are the same as the latest release).

For my OS (Windows) I got [B]libmuse_android-1.0.0.zip[/B] and extracted to my root C:\

The “Getting Started” page just explain wich SDK Packages of Android you must install with SDK Manager (supposing you are using Android Studio as your development tool), and how to open and build the example file that comes with LibMuse.

I’m going to test it today. Good luck !

Eduardo


#4

Hi all!

Really excited about the Android SDK release!

I was just trying to run your example App included in the release in Eclipse ADT (as described here: https://sites.google.com/a/interaxon.ca/muse-developer-site/libmuse/android-development)
and ran into a small problem:

02-05 13:11:40.468: E/AndroidRuntime(18725): FATAL EXCEPTION: main
02-05 13:11:40.468: E/AndroidRuntime(18725): java.lang.ExceptionInInitializerError
02-05 13:11:40.468: E/AndroidRuntime(18725): at java.lang.Class.newInstanceImpl(Native Method)
02-05 13:11:40.468: E/AndroidRuntime(18725): at java.lang.Class.newInstance(Class.java:1319)
02-05 13:11:40.468: E/AndroidRuntime(18725): at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
02-05 13:11:40.468: E/AndroidRuntime(18725): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2007)
02-05 13:11:40.468: E/AndroidRuntime(18725): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
02-05 13:11:40.468: E/AndroidRuntime(18725): at android.app.ActivityThread.access$700(ActivityThread.java:134)
02-05 13:11:40.468: E/AndroidRuntime(18725): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
02-05 13:11:40.468: E/AndroidRuntime(18725): at android.os.Handler.dispatchMessage(Handler.java:99)
02-05 13:11:40.468: E/AndroidRuntime(18725): at android.os.Looper.loop(Looper.java:137)
02-05 13:11:40.468: E/AndroidRuntime(18725): at android.app.ActivityThread.main(ActivityThread.java:4867)
02-05 13:11:40.468: E/AndroidRuntime(18725): at java.lang.reflect.Method.invokeNative(Native Method)
02-05 13:11:40.468: E/AndroidRuntime(18725): at java.lang.reflect.Method.invoke(Method.java:511)
02-05 13:11:40.468: E/AndroidRuntime(18725): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
02-05 13:11:40.468: E/AndroidRuntime(18725): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
02-05 13:11:40.468: E/AndroidRuntime(18725): at dalvik.system.NativeStart.main(Native Method)
02-05 13:11:40.468: E/AndroidRuntime(18725): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]: 1687 could not load needed library ‘libc++_shared.so’ for ‘libmuse_android.so’ (load_library[1093]: Library ‘libc++_shared.so’ not found)
02-05 13:11:40.468: E/AndroidRuntime(18725): at java.lang.Runtime.loadLibrary(Runtime.java:370)
02-05 13:11:40.468: E/AndroidRuntime(18725): at java.lang.System.loadLibrary(System.java:535)
02-05 13:11:40.468: E/AndroidRuntime(18725): at com.interaxon.test.libmuse.MainActivity.<clinit>(MainActivity.java:59)
02-05 13:11:40.468: E/AndroidRuntime(18725): … 15 more

It seems to me that a dependent library (libc++_shared.so) is not being loaded, so to fix this I added the following:

public class MainActivity extends Activity implements OnClickListener {
static {
// Loads the muse native library.
System.loadLibrary(“c++_shared”); //add this to prevent UnsatisfiedLinkError
System.loadLibrary(“muse_android”);
}

}

It works as expected now :slight_smile:

Thanks for the example app, will start with my own one right away!

curiousHybrid


#5

Thank you for the information , curiousHybrid
It works without any change using Android Studio, though.
But as I am interested in creating a plugin for Unity this will be very useful.


#6

SDK dev here—thanks for trying out the SDK and for the detailed report, curiousHybrid!

In testing, this behavior appears dependent on Android version: later versions appear to automatically load dependent shared libraries (or, at least, to load libc++_shared.so), whereas earlier versions don’t. What version of Android are you using?

In any case, getting an exception is clearly bogus, so in the next point release we’ll probably link c++_static instead of c++_shared as a workaround until we can figure out how to get shared linking working right without requiring users to add extra calls to System.loadLibrary. Your workaround should also work just fine until then.


#7

hey steven,

I was using Android 4.1.2 earlier, but will try again with a device running 4.4.2.


#8

Yeah, that makes sense… I saw it break on 4.0.3. I’d be surprised if there was an issue with 4.4.2.


#9

Hey all,

Based on feedback from several developers, we’ve separated LibMuse out into its own installer. So now the SDK consists of two components, the Muse SDK Tools (MuseLab, MuseIO, and MusePlayer) and LibMuse. These can be downloaded from developer.choosemuse.com.

We’ve also made several improvements to LibMuse already and released them in LibMuse 1.0.1. Here’s a quick summary:

LibMuse 1.0.1 changes:

  • [SIZE=13px]Better error handling[/SIZE]
  • [SIZE=13px]Documentation improvements (added info about threading and exceptions)[/SIZE]
  • [SIZE=13px]Link C++ lib statically[/SIZE]
  • [SIZE=13px]Added new API to MuseManager class to allow to scan for Muse headbands which have custom names[/SIZE]
  • [SIZE=13px]Split libmuse and MuseSDK installers[/SIZE]
  • [SIZE=13px]Provided linux-x64 installer[/SIZE]
[SIZE=13px]@curiousHybrid, the static linking of libc++ should solve the issue you were seeing. Let us know if you run into anything else![/SIZE]