diff --git a/pkgs/ok_http/.gitignore b/pkgs/ok_http/.gitignore index 2e58cc573d..ac5aa9893e 100644 --- a/pkgs/ok_http/.gitignore +++ b/pkgs/ok_http/.gitignore @@ -27,6 +27,3 @@ migrate_working_dir/ **/doc/api/ .dart_tool/ build/ - -# Ignore the JAR files required to generate JNI Bindings -jar/ diff --git a/pkgs/ok_http/android/build.gradle b/pkgs/ok_http/android/build.gradle index c21dab37b0..ea25148737 100644 --- a/pkgs/ok_http/android/build.gradle +++ b/pkgs/ok_http/android/build.gradle @@ -4,6 +4,8 @@ group = "com.example.ok_http" version = "1.0" buildscript { + // Required to support `okhttp:4.12.0`. + ext.kotlin_version = '1.9.23' repositories { google() mavenCentral() @@ -12,6 +14,7 @@ buildscript { dependencies { // The Android Gradle Plugin knows how to build native code with the NDK. classpath("com.android.tools.build:gradle:7.3.0") + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/pkgs/ok_http/example/android/app/build.gradle b/pkgs/ok_http/example/android/app/build.gradle index 77ac8ef7fd..b5f9467b2f 100644 --- a/pkgs/ok_http/example/android/app/build.gradle +++ b/pkgs/ok_http/example/android/app/build.gradle @@ -56,3 +56,10 @@ android { flutter { source = "../.." } + +dependencies { + // "com.squareup.okhttp3:okhttp:4.12.0" is only present so that + // `jnigen` will work. Applications should not include this line. + // The version should be synced with `pkgs/ok_http/android/build.gradle`. + implementation('com.squareup.okhttp3:okhttp:4.12.0') +} diff --git a/pkgs/ok_http/jnigen.yaml b/pkgs/ok_http/jnigen.yaml index 1d0d60d457..fbb5bdf776 100644 --- a/pkgs/ok_http/jnigen.yaml +++ b/pkgs/ok_http/jnigen.yaml @@ -1,7 +1,4 @@ -# To regenerate the JNI Bindings, download the OkHttp 4.12.0 JAR file from the Maven Repository -# and place them in 'jar/'. -# https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/4.12.0 -# Then run the command: dart run jnigen --config jnigen.yaml +# Regenerate the JNI Bindings using: dart run jnigen --config jnigen.yaml summarizer: backend: asm @@ -11,6 +8,10 @@ output: path: "lib/src/jni/bindings.dart" structure: single_file +android_sdk_config: + add_gradle_deps: true + android_example: "example/" + enable_experiment: - "interface_implementation" @@ -81,6 +82,3 @@ exclude: - "okhttp3.Headers#-deprecated_size" - "okhttp3.Dispatcher#-deprecated_executorService" - "okhttp3.Cache#-deprecated_directory" - -class_path: - - "jar/okhttp-4.12.0.jar"