diff --git a/dev/integration_tests/deferred_components_test/android/component1/build.gradle b/dev/integration_tests/deferred_components_test/android/component1/build.gradle index 5354de1031..219917dbb6 100644 --- a/dev/integration_tests/deferred_components_test/android/component1/build.gradle +++ b/dev/integration_tests/deferred_components_test/android/component1/build.gradle @@ -23,8 +23,8 @@ if (flutterVersionName == null) { apply plugin: "com.android.dynamic-feature" android { - namespace "io.flutter.integration.deferred_components_test.component1" - compileSdk 35 + namespace = "io.flutter.integration.deferred_components_test.component1" + compileSdk = 35 // Flutter's CI installs the NDK at a non-standard path. // This non-standard structure is initially created by @@ -43,15 +43,15 @@ android { } defaultConfig { - minSdkVersion 21 - targetSdkVersion 35 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + minSdk = 21 + targetSdk = 35 + versionCode = flutterVersionCode.toInteger() + versionName = flutterVersionName } compileOptions { - sourceCompatibility 1.8 - targetCompatibility 1.8 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } } diff --git a/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/build.gradle b/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/build.gradle index 166d06bf6a..45e6936623 100644 --- a/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/build.gradle +++ b/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/build.gradle @@ -6,7 +6,7 @@ apply plugin: 'com.android.application' android { namespace = "io.flutter.addtoapp" - compileSdk 35 + compileSdk = 35 // Flutter's CI installs the NDK at a non-standard path. // This non-standard structure is initially created by @@ -23,11 +23,11 @@ android { } defaultConfig { - applicationId "io.flutter.addtoapp" - minSdkVersion 21 - targetSdkVersion 35 - versionCode 1 - versionName "1.0" + applicationId = "io.flutter.addtoapp" + minSdk = 21 + targetSdk = 35 + versionCode = 1 + versionName = "1.0" } // Test build types. buildTypes { diff --git a/docs/contributing/Android-API-And-Related-Versions.md b/docs/contributing/Android-API-And-Related-Versions.md index a8cd1b01e4..c472903718 100644 --- a/docs/contributing/Android-API-And-Related-Versions.md +++ b/docs/contributing/Android-API-And-Related-Versions.md @@ -107,7 +107,7 @@ Gradle versions are the least likley to break across minor version updates. distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip ``` -### kotlin +### Kotlin Changing kotlin versions is most likley to have an issue with another dependency and not the code under test. @@ -120,3 +120,46 @@ ext.kotlin_version = "1.7.10" ... classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" ``` + +### compileOptions and kotlinOptions + +- sourceCompatibility must use JavaVersion.* +- targetCompatibility must use JavaVersion.* +- kotlinOptions jvmTarget should match the versions used by compileOptions or there should be a comment explaining why. +- jvmTarget should use JavaVersion..toString() or there should be a comment explaining why. + +``` +// Ok +compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 +} + +kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() +} +``` + +``` +// Not ok +compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +kotlinOptions { + jvmTarget = "17" +} +``` + +``` +// Not ok +compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 +} + +kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() +} +```