problem with react component on Android 6


I programmed the board to turn on the LED when angular speed goes above a threshold. This is the code:
Log.i(LOG_DATA_STREAM, "setupLedActivation started");
gyro.angularVelocity().addRouteAsync(new RouteBuilder() {
public void configure(RouteComponent source) {
//source.split().index(0).filter(ThresholdOutput.ABSOLUTE,minAngularSpeed,1f).react(new RouteComponent.Action() {
.filter(ThresholdOutput.BINARY, minAngularSpeed, 10)
.filter(Comparison.EQ, 1)
.react(new RouteComponent.Action() {
public void execute(DataToken token) {
led.editPattern(Led.Color.GREEN, Led.PatternPreset.SOLID).commit();;
.to().filter(Comparison.EQ, -1)
.react(new RouteComponent.Action() {
public void execute(DataToken token) {
new Continuation<Route, Void>() {
public Void then(Task<Route> task) throws Exception {
if (task.isFaulted()) {
Log.e(LOG_DATA_STREAM, metawear.isConnected() ? "Error setting up route" : "Error connecting", task.getError());
} else {
Log.i(LOG_DATA_STREAM, "setupLedActivation done");
onBoardRoute = task.getResult();
//debug = mwBoard.getModule(Debug.class);
//logging= mwBoard.getModule(Logging.class);

return null;
This works fine in Android 4.4, but on a different device with Android 6.0 it fails, with the following output in the Android Monitor:

12-29 16:56:49.545 10800-10800/it.beonsolutions.rehab_home I/DATA_STREAM: setupLedActivation started
12-29 16:56:50.002 10800-10968/it.beonsolutions.rehab_home E/DATA_STREAM: Error setting up route
  java.util.concurrent.TimeoutException: Creating data processor timed out
      at com.mbientlab.metawear.impl.DataProcessorImpl$
      at java.util.concurrent.Executors$
      at java.util.concurrent.ScheduledThreadPoolExecutor$
      at java.util.concurrent.ThreadPoolExecutor.runWorker(
      at java.util.concurrent.ThreadPoolExecutor$
12-29 16:56:50.035 10800-11346/it.beonsolutions.rehab_home W/BluetoothGatt: Unhandled exception in callback
  java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Queue.poll()' on a null object reference
      at com.mbientlab.metawear.impl.DataProcessorImpl$2.onResponseReceived(
      at com.mbientlab.metawear.impl.JseMetaWearBoard$5.onMwNotifyCharChanged(
      at android.bluetooth.BluetoothGatt$1.onNotify(
      at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(
      at android.os.Binder.execTransact(

Any help would be much appreciated.


    • What version of the SDK are you running?
    • What board are you using?
      • What are the firmware and hardware revisions?
    • What Android devices are you testing with?
  • metaware SKD: 3.0.0

    for the board information, please see this screenshot:

    Android device: Lenovo TB3-730X

    Thanks & Regards
  • Are you using that device with both Android 4.4 and 6.0?  

    The code works fine on my Android x86 VM and Nexus 5.  Try using another Android device.
  • What are you using to run Android 6 on a VM? I'm tried to use VirtualBox but I'm having troubles. Can you point me to some instructions?
  • OK, I tried on another device running Android 6 and the code worked fine.

    Is there anything to do to understand the issue with the Lenovo tablet?
  • Based on the log output, it looks like the tablet needs more time to wait for a response from the remote device.  The latest Android SDK has an increased timeout period so I'd try updating your compile dependency.
  • I tried with 3.3.0 but then I get the following error during build:

    Error:Error converting bytecode to dex:
    Cause: Dex cannot parse version 52 byte code.
    This is caused by library dependencies that have been compiled using Java 8 or above.
    If you are using the 'java' gradle plugin in a library submodule add
    targetCompatibility = '1.7'
    sourceCompatibility = '1.7'
    to that submodule's build.gradle file.

    I tried to follow the suggested solution but then other issues arise. Please give the correct project setup for 3.3.0.

    Thanks and Regards
  • Thank you. I checked that page but passed by the little note about SDK 3.3.
  • Yes, upgrade did the job done!
This discussion has been closed.