Skip to content

[jni_flutter] 1.0.4 requires package:jni ^1.1.0 but pubspec still allows ^1.0.0 #3722

Closed

Description

@Adam-Langley

Summary

jni_flutter 1.0.4 (published 2026-10-01) contains generated bindings that assert package:jni ^1.1.0 at compile time via JniVersionCheck(1, 1), but its pubspec.yaml still declares jni: ^1.0.0. Pub therefore happily resolves jni_flutter 1.0.4 alongside jni 1.0.x, and the app then fails to compile instead of failing at version resolution.

Steps to reproduce

  1. In a Flutter app that (transitively) depends on jni_flutter, constrain jni to 1.0.x, e.g.
    dependency_overrides:
      jni: 1.0.0   # workaround for #3497 (AGP 9)
  2. Run flutter pub get with no lockfile -> resolves jni_flutter 1.0.4 + jni 1.0.0.
  3. flutter build macos (also reproduced on other targets).

Actual result

../../../../../.pub-cache/hosted/pub.dev/jni_flutter-1.0.4/lib/src/generated_plugin.dart:46:33: Error: Constant evaluation error:
const _$jniVersionCheck = jni$_.JniVersionCheck(1, 1);
                                ^
../../../../../.pub-cache/hosted/pub.dev/jni-1.0.0/lib/src/version_check.dart:16:41: Context: This assertion failed with message: The generated bindings expect package:jni ^1.1.0, but 1.0.x was imported.
actualMajorVersion == major && actualMinorVersion >= minor,
                                        ^
../../../../../.pub-cache/hosted/pub.dev/jni_flutter-1.0.4/lib/src/generated_plugin.dart:46:7: Context: While analyzing:
const _$jniVersionCheck = jni$_.JniVersionCheck(1, 1);
      ^
Target kernel_snapshot_program failed: Exception

Expected result

jni_flutter 1.0.4's pubspec should declare jni: ^1.1.0 so that pub either picks a compatible jni or falls back to jni_flutter 1.0.3, rather than producing a broken build.

Suggested fix

  • Bump the jni lower bound in pkgs/jni_flutter/pubspec.yaml to ^1.1.0 and publish 1.0.5.
  • Consider retracting 1.0.4 on pub.dev, since any project resolving it with jni < 1.1.0 is broken.
  • Possibly add a CI check that the JniVersionCheck emitted by jnigen matches the jni constraint in the package's pubspec.

Workaround

dependency_overrides:
  jni_flutter: 1.0.3

Environment

  • Flutter 3.47.5 (stable)
  • jni_flutter 1.0.4, jni 1.0.0
  • Building on macOS (Azure Pipelines hosted agent)

Activity

  1. added
    P1A high priority bug; for example, a single project is unusable or has many test failures
    on Oct 1, 2026
  2. dcharkes commented on Oct 1, 2026

    @dcharkes
    Collaborator
    • Consider retracting 1.0.4 on pub.dev, since any project resolving it with jni < 1.1.0 is broken.

    Done. To turn CIs green again.

    @liamappelbe can you publish a version with the right dependencies?

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

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failures

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions