Skip to content

jni version out of date #416

Description

@Gibbz

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.

Activity

  1. qdot commented on Dec 23, 2024

    @qdot
    Contributor

    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.

  2. qdot commented on Apr 27, 2026

    @qdot
    Contributor
  3. qdot commented on Aug 30, 2026

    @qdot
    Contributor

    This was generated by AI during triage.

    Closing this issue because the repository now uses the newer JNI version and the outdated dependency described in this report is no longer present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions