diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 8badfc2..eec7f63 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,6 +1,8 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + plugins { id("com.android.application") - // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + // AGP 9 bundles Kotlin natively - no explicit plugin needed here id("dev.flutter.flutter-gradle-plugin") } @@ -14,15 +16,15 @@ android { targetCompatibility = JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() + // AGP 9's bundled Kotlin - use the native DSL + kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + } } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.hyperling.expense_tracker" - // You can update the following values to match your application needs. - // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode @@ -31,8 +33,6 @@ android { buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. signingConfig = signingConfigs.getByName("debug") } } diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..8f502c1 --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,2 @@ +// Expose Kotlin version for Flutter's plugin validation (AGP 9 bundles Kotlin natively) +ext.kotlin_version = "2.4.20" diff --git a/android/gradle.properties b/android/gradle.properties index 4147ba3..a904a29 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -2,6 +2,8 @@ org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryErro android.useAndroidX=true android.enableJetifier=true # This builtInKotlin flag was added automatically by Flutter migrator -android.builtInKotlin=false +android.builtInKotlin=true # This newDsl flag was added automatically by Flutter migrator android.newDsl=false +# Force the Kotlin version resolver in AGP 9 to use our target version +kotlin.version=2.4.20 diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts index 9891e36..acc0b52 100644 --- a/android/settings.gradle.kts +++ b/android/settings.gradle.kts @@ -18,9 +18,12 @@ pluginManagement { plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "9.4.1" apply false + + // This must exist to satisfy Flutter's Gradle plugin validation for AGP 9 bundled Kotlin: + // "Error: Your project's Kotlin version (2.2.10) is lower than Flutter's minimum supported version of 2.2.20." id("org.jetbrains.kotlin.android") version "2.4.20" apply false - id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" } include(":app")