From c0b732bc196f7183367ba51ff954e683c8fa57bf Mon Sep 17 00:00:00 2001 From: Hossein Yousefi Date: Mon, 27 Oct 2025 13:35:23 +0100 Subject: [PATCH 1/2] [cronet_http] Fix `ClassNotFoundException` in debug mode --- pkgs/cronet_http/CHANGELOG.md | 4 ++++ .../flutter/plugins/cronet_http/UrlRequestCallbackProxy.kt | 5 ++++- pkgs/cronet_http/pubspec.yaml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/cronet_http/CHANGELOG.md b/pkgs/cronet_http/CHANGELOG.md index d5577055e5..b56b8126ea 100644 --- a/pkgs/cronet_http/CHANGELOG.md +++ b/pkgs/cronet_http/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.6.1 + +* Fix a bug where cronet would throw `ClassNotFoundException` in debug mode. + ## 1.6.0 * Upgrade the `cronet-embedded` dependency to `141.7340` version to diff --git a/pkgs/cronet_http/android/src/main/kotlin/io/flutter/plugins/cronet_http/UrlRequestCallbackProxy.kt b/pkgs/cronet_http/android/src/main/kotlin/io/flutter/plugins/cronet_http/UrlRequestCallbackProxy.kt index 23c3100f7a..584071817e 100644 --- a/pkgs/cronet_http/android/src/main/kotlin/io/flutter/plugins/cronet_http/UrlRequestCallbackProxy.kt +++ b/pkgs/cronet_http/android/src/main/kotlin/io/flutter/plugins/cronet_http/UrlRequestCallbackProxy.kt @@ -14,6 +14,7 @@ package io.flutter.plugins.cronet_http +import androidx.annotation.Keep import org.chromium.net.CronetException import org.chromium.net.UrlRequest import org.chromium.net.UrlResponseInfo @@ -31,8 +32,10 @@ import java.nio.ByteBuffer // parameter is nullable as specified in the cronet source code: // https://source.chromium.org/chromium/chromium/src/+/main:components/cronet/android/api/src/org/chromium/net/UrlRequest.java;l=232 +@Keep class UrlRequestCallbackProxy(val callback: UrlRequestCallbackInterface) : UrlRequest.Callback() { - public interface UrlRequestCallbackInterface { + @Keep + interface UrlRequestCallbackInterface { fun onRedirectReceived( request: UrlRequest?, info: UrlResponseInfo?, diff --git a/pkgs/cronet_http/pubspec.yaml b/pkgs/cronet_http/pubspec.yaml index 258f01ec9c..986b50b1dd 100644 --- a/pkgs/cronet_http/pubspec.yaml +++ b/pkgs/cronet_http/pubspec.yaml @@ -1,5 +1,5 @@ name: cronet_http -version: 1.6.0 +version: 1.6.1-wip description: >- An Android Flutter plugin that provides access to the Cronet HTTP client. repository: https://github.com/dart-lang/http/tree/master/pkgs/cronet_http From 1196eb73ba98f0699f579db8c19644f44636b126 Mon Sep 17 00:00:00 2001 From: Hossein Yousefi Date: Mon, 3 Nov 2025 17:42:26 +0100 Subject: [PATCH 2/2] Update changelog --- pkgs/cronet_http/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cronet_http/CHANGELOG.md b/pkgs/cronet_http/CHANGELOG.md index b56b8126ea..2a5afb4897 100644 --- a/pkgs/cronet_http/CHANGELOG.md +++ b/pkgs/cronet_http/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.6.1 +## 1.6.1-wip * Fix a bug where cronet would throw `ClassNotFoundException` in debug mode.