You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
native adapter incompatible with cronet_http 1.9.0 #2581
I reproduced the incompatibility. It is a dependency-constraint conflict, not a runtime crash: native_dio_adapter 1.7.0 pins package:jni to ^0.14.0, while cronet_http 1.9.0 requires package:jni ^1.0.0. The two jni constraints are disjoint, so flutter pub get fails before any code runs.
Root cause
plugins/native_dio_adapter/pubspec.yaml (1.7.0, also current main):
cronet_http: ^1.5.0 # allows 1.9.0 to be selectedjni: ^0.14.0 # = >=0.14.0 <0.15.0
cronet_http 1.9.0 (changelog) bumped package:jni to 1.0 and package:jnigen to 0.16.0, so its pubspec declares:
jni: ^1.0.0 # = >=1.0.0 <2.0.0
^0.14.0 ∩ ^1.0.0 = ∅, and cronet_http: ^1.5.0 lets pub pick 1.9.0, so resolution dead-ends. The jni constraint in native_dio_adapter was added intentionally (see the comment in pubspec.yaml) to track the version cronet_http: ^1.5.0 resolved to — that assumption broke when cronet_http crossed the jni 0.x → 1.0 boundary.
A secondary blocker: lib/src/cronet_fallback_adapter.dart imports JniException from package:jni:
JniException is not part of the jni 1.0 API (it was replaced by JThrowable), so bumping the constraint also requires updating this classification code.
Minimal reproduction
pubspec.yaml (Flutter app, nothing else needed — the failure is at pub get):
Resolving dependencies...
Because cronet_http >=1.9.0 depends on jni ^1.0.0 and native_dio_adapter >=1.7.0 depends on jni ^0.14.0, cronet_http >=1.9.0 is incompatible with native_dio_adapter >=1.7.0.
So, because repro_2581 depends on both native_dio_adapter 1.7.0 and cronet_http 1.9.0, version solving failed.
You can try the following suggestion to make the pubspec resolve:
* Consider downgrading your constraint on cronet_http: flutter pub add cronet_http:^1.6.0
Correspondence to the report
The "incompatible" actual result in the issue is exactly this resolution failure. The report's note "JNI in cronet should be bump to 1.0" matches the fix direction: relax jni to ^1.0.0 (or a range spanning both, e.g. >=0.14.0 <2.0.0) and migrate JniException → JThrowable in cronet_fallback_adapter.dart.
Environment
native_dio_adapter: 1.7.0 (also verified on current main)
cronet_http: 1.9.0
Flutter: 3.24.3 (stable), Dart 3.5.x
Workaround for affected users
Pin cronet_http to ^1.6.0 (i.e. <=1.8.0) until native_dio_adapter ships a release with a widened jni constraint:
flutter pub add cronet_http:^1.6.0
Note
A related request was filed in #2580 ("Add support for jni 1.0.0") but was closed because it used the infra/blank template, which is restricted to moderators. The underlying ask — widen jni and migrate off JniException — is the same as what this issue points at.
This comment was generated by AI agent omp (model: devin/glm-5-2).
Activity
CaiJingLong commentedon Jul 27, 2026
Confirmed — version solving fails
I reproduced the incompatibility. It is a dependency-constraint conflict, not a runtime crash:
native_dio_adapter1.7.0 pinspackage:jnito^0.14.0, whilecronet_http1.9.0 requirespackage:jni ^1.0.0. The twojniconstraints are disjoint, soflutter pub getfails before any code runs.Root cause
plugins/native_dio_adapter/pubspec.yaml(1.7.0, also currentmain):cronet_http1.9.0 (changelog) bumpedpackage:jnito 1.0 andpackage:jnigento 0.16.0, so its pubspec declares:^0.14.0∩^1.0.0= ∅, andcronet_http: ^1.5.0lets pub pick 1.9.0, so resolution dead-ends. Thejniconstraint innative_dio_adapterwas added intentionally (see the comment inpubspec.yaml) to track the versioncronet_http: ^1.5.0resolved to — that assumption broke whencronet_httpcrossed the jni 0.x → 1.0 boundary.A secondary blocker:
lib/src/cronet_fallback_adapter.dartimportsJniExceptionfrompackage:jni:JniExceptionis not part of the jni 1.0 API (it was replaced byJThrowable), so bumping the constraint also requires updating this classification code.Minimal reproduction
pubspec.yaml(Flutter app, nothing else needed — the failure is atpub get):Run:
Observed output
Correspondence to the report
The "incompatible" actual result in the issue is exactly this resolution failure. The report's note "JNI in cronet should be bump to 1.0" matches the fix direction: relax
jnito^1.0.0(or a range spanning both, e.g.>=0.14.0 <2.0.0) and migrateJniException→JThrowableincronet_fallback_adapter.dart.Environment
native_dio_adapter: 1.7.0 (also verified on currentmain)cronet_http: 1.9.0Workaround for affected users
Pin
cronet_httpto^1.6.0(i.e.<=1.8.0) untilnative_dio_adapterships a release with a widenedjniconstraint:Note
A related request was filed in #2580 ("Add support for jni 1.0.0") but was closed because it used the infra/blank template, which is restricted to moderators. The underlying ask — widen
jniand migrate offJniException— is the same as what this issue points at.This comment was generated by AI agent omp (model: devin/glm-5-2).
🐛 Support cronet_http 1.9.0 by upgrading jni to ^1.0.0 (#2582)