Open JosuGZ opened 10 months ago
Ok, I made some progress, it seems that given mut env: JNIEnv<'local>
I can add this (as long as I use the same version of the jni crate...):
#[cfg(target_os = "android")]
btleplug::platform::init(&env);
Now I'm getting this, which probably means I'm not loading the Java libraries properly...
JNI DETECTED ERROR IN APPLICATION: JNI NewStringUTF called with pending exception java.lang.ClassNotFoundException: Didn't find class "com.nonpolynomial.btleplug.android.impl.Adapter"
Adding this works:
#[cfg(target_os = "android")]
btleplug::platform::init(&env);
Setting gradle is tricky though.
I'm getting this problem when running on Android: "Droidplug has not been initialized. Please initialize it with btleplug::platform::init().".
Should I have to call this myself? If that is the case an example on the README would be nice, although perhaps the problem is on how I'm (trying) to add the Java code to the project.