Reputation: 111
I am trying to figure out how to get sensors data from Health Services on Wear OS.
I'm trying to run samples (Passive Data Sample) from the official guide on Emulator for Wear OS API 30 (He is available in Beta Android Studio Arctic Fox), but I get this error:
2021-07-02 16:55:54.041 7172-7200/com.example.passivedata E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
Process: com.example.passivedata, PID: 7172
java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.google.common.util.concurrent.ListenableFuture.cancel(boolean)' on a null object reference
at android.os.Parcel.createExceptionOrNull(Parcel.java:2392)
at android.os.Parcel.createException(Parcel.java:2370)
at android.os.Parcel.readException(Parcel.java:2353)
at android.os.Parcel.readException(Parcel.java:2295)
at androidx.health.services.client.impl.IPassiveMonitoringApiService$Stub$Proxy.registerDataCallback(IPassiveMonitoringApiService.java:318)
at androidx.health.services.client.impl.ServiceBackedPassiveMonitoringClient$registerDataCallbackInternal$serviceOperation$1.execute(ServiceBackedPassiveMonitoringClient.kt:122)
at androidx.health.services.client.impl.ipc.Client$3.execute(Client.java:222)
at androidx.health.services.client.impl.ipc.internal.ServiceConnection.execute(ServiceConnection.java:243)
at androidx.health.services.client.impl.ipc.internal.ServiceConnection.enqueue(ServiceConnection.java:200)
at androidx.health.services.client.impl.ipc.internal.ConnectionManager.handleMessage(ConnectionManager.java:123)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
Has anyone faced a similar problem?
Upvotes: 4
Views: 2111
Reputation: 361
You just need to update this package
react-native-reanimated
npm i [email protected]
after installing this version of the package, just restart your simulator.
Upvotes: 0
Reputation: 101
change enableHermes from false to true in your android/app/build.gradle file
project.ext.react = [
enableHermes: true
]
add these line in android/app/src/main/java/com/yourProjectName/MainApplication.java
import com.facebook.react.bridge.JSIModulePackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
@Override
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage();
}
//if this is not exist then also add this
@Override
protected String getJSMainModuleName() {
return "index";
}
and rebuild the project
Upvotes: 1