problem with react component on Android 6

Hello,

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() {
@Override
public void configure(RouteComponent source) {
//source.split().index(0).filter(ThresholdOutput.ABSOLUTE,minAngularSpeed,1f).react(new RouteComponent.Action() {
source.split().index(0).average((byte)3)
.map(Function1.ABS_VALUE)
.filter(ThresholdOutput.BINARY, minAngularSpeed, 10)
.multicast()
.to()
.filter(Comparison.EQ, 1)
.react(new RouteComponent.Action() {
@Override
public void execute(DataToken token) {
led.editPattern(Led.Color.GREEN, Led.PatternPreset.SOLID).commit();
led.play();
}
})
.to().filter(Comparison.EQ, -1)
.react(new RouteComponent.Action() {
@Override
public void execute(DataToken token) {
led.stop(true);
}
});
}
}).continueWith(
new Continuation<Route, Void>() {
@Override
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$1.run(DataProcessorImpl.java:129)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                              at java.lang.Thread.run(Thread.java:818)
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(DataProcessorImpl.java:138)
      at com.mbientlab.metawear.impl.JseMetaWearBoard$5.onMwNotifyCharChanged(JseMetaWearBoard.java:579)
      at com.mbientlab.metawear.android.BtleService$1.onCharacteristicChanged(BtleService.java:193)
      at android.bluetooth.BluetoothGatt$1.onNotify(BluetoothGatt.java:487)
      at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:399)
      at android.os.Binder.execTransact(Binder.java:458)

Any help would be much appreciated.
Regards

Comments

    • 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:
    https://www.dropbox.com/s/ftx6ysedj7h3mxl/Screenshot_2018-01-03-10-00-08.png?dl=0

    Android device: Lenovo TB3-730X

    Thanks & Regards
    Luca
  • 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!
    Thanks!
This discussion has been closed.