btleplug icon indicating copy to clipboard operation
btleplug copied to clipboard

jni version out of date

Open Gibbz opened this issue 1 year ago • 1 comments

Describe the bug current version jni = "0.21.1" in the library its jni = "0.19.0" this is causing incompatability issues in my app.

Expected behavior working with the latest version


error[E0308]: mismatched types
   --> src/android.rs:53:30
    |
53  |     btleplug::platform::init(&env).unwrap();
    |     ------------------------ ^^^^ expected `JNIEnv<'_>`, found a different `JNIEnv<'_>`
    |     |
    |     arguments to this function are incorrect
    |
    = note: `JNIEnv<'_>` and `JNIEnv<'_>` have similar names, but are actually distinct types
note: `JNIEnv<'_>` is defined in crate `jni`
   --> /home/bronson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jni-0.21.1/src/wrapper/jnienv.rs:196:1
    |
196 | pub struct JNIEnv<'local> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: `JNIEnv<'_>` is defined in crate `jni`
   --> /home/bronson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jni-0.19.0/src/wrapper/jnienv.rs:79:1
    |
79  | pub struct JNIEnv<'a> {
    | ^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `jni` are being used?
note: function defined here
   --> /home/bronson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/btleplug-0.11.7/src/droidplug/mod.rs:12:8
    |
12  | pub fn init(env: &JNIEnv) -> crate::Result...
    |        ^^^^

If i change the version of jni in my cargo down to the same version, i get 19 new other errors... But ive managed to downgrade the version for now and its fixed the error.

Gibbz avatar Dec 23 '24 12:12 Gibbz

Yeah we've got #281 and #376 related to this, but it's gonna be a lot of work that I haven't had time for.

qdot avatar Dec 23 '24 17:12 qdot