Repository navigation
Closed
Labels
P1A high priority bug; for example, a single project is unusable or has many test failuresA high priority bug; for example, a single project is unusable or has many test failures
Description
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
- In a Flutter app that (transitively) depends on
jni_flutter, constrainjnito 1.0.x, e.g.dependency_overrides: jni: 1.0.0 # workaround for #3497 (AGP 9)
- Run
flutter pub getwith no lockfile -> resolvesjni_flutter 1.0.4+jni 1.0.0. 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
jnilower bound inpkgs/jni_flutter/pubspec.yamlto^1.1.0and 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
JniVersionCheckemitted by jnigen matches thejniconstraint in the package's pubspec.
Workaround
dependency_overrides:
jni_flutter: 1.0.3Environment
- Flutter 3.47.5 (stable)
- jni_flutter 1.0.4, jni 1.0.0
- Building on macOS (Azure Pipelines hosted agent)
Reacted by Giancarlo Buenaflor
Metadata
Metadata
Assignees
Labels
P1A high priority bug; for example, a single project is unusable or has many test failuresA high priority bug; for example, a single project is unusable or has many test failures
Activity
ci: Pin jni_flutter to 1.0.3 in Flutter example
feat(tracing)!: Default to streaming traces (#4057)
dcharkes commentedon Oct 1, 2026
Done. To turn CIs green again.
@liamappelbe can you publish a version with the right dependencies?
dcharkes commentedon Oct 6, 2026
Published: https://pub.dev/packages/jni_flutter/versions/1.0.4+1