diff --git a/.ci.yaml b/.ci.yaml index 38ba297be117..7c4d54fe17a4 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -395,34 +395,13 @@ targets: properties: version_file: flutter_master.version # This builds the all_packages app only in a current JDK. - target_file: android_build_all_packages_jdk17.yaml + target_file: android_build_all_packages.yaml channel: master env_variables: >- { "CHANNEL": "master" } - - name: Linux_android android_build_all_packages_legacy master - recipe: packages/packages - timeout: 30 - properties: - version_file: flutter_master.version - # TODO(stuartmorgan): Once stable requires JDK 17, and the - # legacy project is updated accordingly, this entire target - # can be merged back into android_build_all_packages. - # This file only builds a *legacy* version of the project. - target_file: android_build_all_packages_legacy.yaml - channel: master - # The legacy project build requires an older JDK. - dependencies: >- - [ - {"dependency": "open_jdk", "version": "version:11"} - ] - env_variables: >- - { - "CHANNEL": "master" - } - - name: Linux_android android_build_all_packages stable recipe: packages/packages timeout: 30 @@ -430,31 +409,13 @@ targets: add_recipes_cq: "true" version_file: flutter_stable.version # This builds the all_packages app only in a current JDK. - target_file: android_build_all_packages_jdk17.yaml + target_file: android_build_all_packages.yaml channel: stable env_variables: >- { "CHANNEL": "stable" } - - name: Linux_android android_build_all_packages_legacy stable - recipe: packages/packages - timeout: 30 - properties: - version_file: flutter_stable.version - # This file only builds a *legacy* version of the project. - target_file: android_build_all_packages_legacy.yaml - channel: stable - # The legacy project build requires an older JDK. - dependencies: >- - [ - {"dependency": "open_jdk", "version": "version:11"} - ] - env_variables: >- - { - "CHANNEL": "stable" - } - - name: Linux_android android_platform_tests_shard_1 master recipe: packages/packages timeout: 60 diff --git a/.ci/legacy_project/README.md b/.ci/legacy_project/README.md index 1ee7313e73dd..bea90a3fc318 100644 --- a/.ci/legacy_project/README.md +++ b/.ci/legacy_project/README.md @@ -37,16 +37,17 @@ and then deleting everything but `android/` from it: - Added license boilerplate. - Replaced `jcenter` in build.gradle with `mavenCentral`, due to the jcenter.bintray.com shutdown. -- Update `compileSdkVersion` from 30 to 33 to maintain compatibility - with plugins that use API 34. -- Updates `gradle-wrapper.properties` from `6.7` to `6.7.1`, to add - support for the Kotlin gradle plugin. If a user runs into this - error, the error message is clear on how to upgrade. -- Modifies `build.gradle` to upgrade the Android Gradle Plugin (AGP) - from version 4.1.0 to 7.0.0. If a user runs into an error with - the AGP version, the warning is clear on how to upgrade - the version to one that we support. +- Update `compileSdkVersion` from 30 to `flutter.compileSdkVersion` in + `build.gradle` to maintain compatibility with plugins that use + Flutter's most recently supported API version. - Modifies `gradle-wrapper.properties` to upgrade the Gradle version - from 6.7.1 to 7.0.2. If a user runs into an error with the Gradle + from 6.7 to 8.0. If a user runs into an error with the Gradle version, the warning is clear on how to upgrade the version to - one that we support. \ No newline at end of file + one that we support. +- Modifies `settings.gradle` to upgrade the Android Gradle Plugin (AGP) + from version 4.1.0 (originally set in `build.gradle`; see bullet below) + to 8.1.0. If a user runs into an error with the AGP version, the warning + is clear on how to upgrade the version to one that we support. +- Refactor plugin to use declarative Gradle apply instead of the + imperative apply (this includes moving where the Android Gradle + Plugin (AGP) version is set from `build.gradle` to `settings.gradle`). diff --git a/.ci/legacy_project/all_packages/android/gradle/wrapper/gradle-wrapper.properties b/.ci/legacy_project/all_packages/android/gradle/wrapper/gradle-wrapper.properties index b8793d3c0d69..89e56bdb6006 100644 --- a/.ci/legacy_project/all_packages/android/gradle/wrapper/gradle-wrapper.properties +++ b/.ci/legacy_project/all_packages/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip diff --git a/.ci/legacy_project/all_packages/android/settings.gradle b/.ci/legacy_project/all_packages/android/settings.gradle index 02d009e408b1..f3d3df7186c2 100644 --- a/.ci/legacy_project/all_packages/android/settings.gradle +++ b/.ci/legacy_project/all_packages/android/settings.gradle @@ -19,7 +19,7 @@ pluginManagement { // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.0.0" apply false + id "com.android.application" version "8.1.0" apply false id "org.jetbrains.kotlin.android" version "1.9.0" apply false } diff --git a/.ci/targets/android_build_all_packages_legacy.yaml b/.ci/targets/android_build_all_packages.yaml similarity index 61% rename from .ci/targets/android_build_all_packages_legacy.yaml rename to .ci/targets/android_build_all_packages.yaml index 6c62e0c3d2a4..ee0a89e823eb 100644 --- a/.ci/targets/android_build_all_packages_legacy.yaml +++ b/.ci/targets/android_build_all_packages.yaml @@ -1,8 +1,17 @@ -# This only builds the legacy all_packages app, which requires jdk11 +# This builds the modern all_packages app and the legacy all_packages app. tasks: - name: prepare tool script: .ci/scripts/prepare_tool.sh infra_step: true # Note infra steps failing prevents "always" from running. + - name: create all_packages app + script: .ci/scripts/create_all_packages_app.sh + infra_step: true # Note infra steps failing prevents "always" from running. + - name: build all_packages for Android debug + script: .ci/scripts/build_all_packages_app.sh + args: ["apk", "debug"] + - name: build all_packages for Android release + script: .ci/scripts/build_all_packages_app.sh + args: ["apk", "release"] - name: create all_packages app - legacy version script: .ci/scripts/create_all_packages_app_legacy.sh # Output dir; must match the final argument to build_all_packages_app_legacy diff --git a/.ci/targets/android_build_all_packages_jdk17.yaml b/.ci/targets/android_build_all_packages_jdk17.yaml deleted file mode 100644 index 4843669b894f..000000000000 --- a/.ci/targets/android_build_all_packages_jdk17.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# This only builds the modern all_packages app, which requires jdk17+ -tasks: - - name: prepare tool - script: .ci/scripts/prepare_tool.sh - infra_step: true # Note infra steps failing prevents "always" from running. - - name: create all_packages app - script: .ci/scripts/create_all_packages_app.sh - infra_step: true # Note infra steps failing prevents "always" from running. - - name: build all_packages for Android debug - script: .ci/scripts/build_all_packages_app.sh - args: ["apk", "debug"] - - name: build all_packages for Android release - script: .ci/scripts/build_all_packages_app.sh - args: ["apk", "release"] diff --git a/script/tool/lib/src/create_all_packages_app_command.dart b/script/tool/lib/src/create_all_packages_app_command.dart index 812c32133b25..2385af12657a 100644 --- a/script/tool/lib/src/create_all_packages_app_command.dart +++ b/script/tool/lib/src/create_all_packages_app_command.dart @@ -243,9 +243,9 @@ dependencies {} gradleFile, replacements: >{ if (gradleFileIsKotlin) - 'compileSdk': ['compileSdk = 34'] + 'compileSdk': ['compileSdk = 35'] else ...>{ - 'compileSdkVersion': ['compileSdk 34'], + 'compileSdkVersion': ['compileSdk 35'], } }, regexReplacements: >{ diff --git a/script/tool/test/create_all_packages_app_command_test.dart b/script/tool/test/create_all_packages_app_command_test.dart index 30ef798fff0a..386a9a07a499 100644 --- a/script/tool/test/create_all_packages_app_command_test.dart +++ b/script/tool/test/create_all_packages_app_command_test.dart @@ -339,7 +339,7 @@ android { buildGradle, containsAll([ contains('This is the legacy file'), - contains('compileSdk 34'), + contains('compileSdk 35'), ])); }); @@ -372,7 +372,7 @@ android { expect( buildGradle, containsAll([ - contains('compileSdk 34'), + contains('compileSdk 35'), contains('androidx.lifecycle:lifecycle-runtime'), ])); });