refactor(package_info_plus): change android gradle from groovy to kotlin#3858
Open
mdmahendri wants to merge 1 commit into
Open
refactor(package_info_plus): change android gradle from groovy to kotlin#3858mdmahendri wants to merge 1 commit into
mdmahendri wants to merge 1 commit into
Conversation
Author
|
After cleaning up the Gradle files from outdated or legacy code, I think we can move forward with the steps to support AGP 9. The migration guide here https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors#supporting-flutter-versions-earlier-than-3-44 has a section on how to keep the minimum Flutter version as it is. We don't even need to change the hardcoded AGP versions in the packages. I will check the 5 remaining packages and clean up their Gradle files next, without changing them to Kotlin DSL. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Background
Starting from Flutter 3.29, new projects use Kotlin DSL by default instead of Groovy for Android build configurations. This can be easily verified by creating a new plugin template:
flutter create --org com.example --template=plugin --platforms=android,ios,web my_pluginSeveral plugins in this repository specify a minimum Flutter SDK higher than 3.29 (see table below). They should follow the latest Android tooling standards and move away from Groovy:
device_info_pluspubspec.yamlnetwork_info_pluspubspec.yamlpackage_info_pluspubspec.yamlshare_pluspubspec.yamlThis change DOES NOT bump the Android Gradle Plugin (AGP) version; the project still targets AGP 8. However, it removes deprecated notations and irrelevant legacy code to align fully with modern AGP expectations.
Additional Gradle Refactors Applied
Alongside the core migration documented in the Gradle Migration Guide and similar change done by the Flutter team in
flutter/packages, the following cleanups were made:lintOptionswas deprecated in AGP 7.2. Migrated to the modernlintblock.implementation "org.jetbrains.kotlin:kotlin-stdlib...". Since Kotlin 1.4, this dependency is added by default by the compiler (reference).sourceSetsblock addingsrc/main/kotlin. Starting with AGP 7, Kotlin source directories are recognized automatically.sourceSets { main.java.srcDirs += 'src/main/kotlin' }kotlinOptions { jvmTarget = 17 }block highlighted by Android Studio('var jvmTarget: String' is deprecated. Please migrate to the compilerOptions DSL. More details are here: https://kotl.in/u1r8ln.).def flutterVersionCodeand just point directly toflutter.versionCodeandflutter.versionNameRelated Issues
flutter/packagesrepository.Checklist
CHANGELOG.mdnor the plugin version inpubspec.yamlfiles.flutter analyze) does not report any problems on my PR. This gradle change already simulated in Android Studio and show no warningsBreaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?