From a17c134589585451f129afdbf218f33688882cfb Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 17 Nov 2026 13:32:07 +0000 Subject: [PATCH] ci(android): upgrade example app to AGP 9 for Flutter 3.50 Flutter stable 3.50.0's Gradle plugin is compiled against AGP 9 and fails with NoSuchMethodError on ApplicationExtension.getDefaultConfig() when the app uses AGP 8.11.1. Align the example app with the Flutter 3.50 templates: Gradle 9.5.0, AGP 9.3.1, KGP 2.4.20, kotlin.compilerOptions. --- .../android/app/build.gradle.kts | 10 ++++++---- .../android/gradle.properties | 4 ++++ .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- .../android/settings.gradle.kts | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/example/webcrypto_demo_flutter_app/android/app/build.gradle.kts b/example/webcrypto_demo_flutter_app/android/app/build.gradle.kts index e3e966244..84db96b28 100644 --- a/example/webcrypto_demo_flutter_app/android/app/build.gradle.kts +++ b/example/webcrypto_demo_flutter_app/android/app/build.gradle.kts @@ -15,10 +15,6 @@ android { targetCompatibility = JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.example.webcrypto_example" @@ -40,6 +36,12 @@ android { } } +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + flutter { source = "../.." } diff --git a/example/webcrypto_demo_flutter_app/android/gradle.properties b/example/webcrypto_demo_flutter_app/android/gradle.properties index fbee1d8cd..e96108cfe 100644 --- a/example/webcrypto_demo_flutter_app/android/gradle.properties +++ b/example/webcrypto_demo_flutter_app/android/gradle.properties @@ -1,2 +1,6 @@ org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true +# This newDsl flag was added by the Flutter template +android.newDsl=false +# This builtInKotlin flag was added by the Flutter template +android.builtInKotlin=false diff --git a/example/webcrypto_demo_flutter_app/android/gradle/wrapper/gradle-wrapper.properties b/example/webcrypto_demo_flutter_app/android/gradle/wrapper/gradle-wrapper.properties index e4ef43fb9..76d4386de 100644 --- a/example/webcrypto_demo_flutter_app/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/webcrypto_demo_flutter_app/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-all.zip diff --git a/example/webcrypto_demo_flutter_app/android/settings.gradle.kts b/example/webcrypto_demo_flutter_app/android/settings.gradle.kts index ca7fe065c..989ac5e46 100644 --- a/example/webcrypto_demo_flutter_app/android/settings.gradle.kts +++ b/example/webcrypto_demo_flutter_app/android/settings.gradle.kts @@ -19,8 +19,8 @@ pluginManagement { plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" - id("com.android.application") version "8.11.1" apply false - id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.android.application") version "9.3.1" apply false + id("org.jetbrains.kotlin.android") version "2.4.20" apply false } include(":app")