feat: migrate to built-in Kotlin for AGP 9+ compatibility - #46
Open
ErnestoNCarrea wants to merge 1 commit into
Open
feat: migrate to built-in Kotlin for AGP 9+ compatibility#46ErnestoNCarrea wants to merge 1 commit into
ErnestoNCarrea wants to merge 1 commit into
Conversation
AGP 9.0 ships built-in Kotlin support, making the standalone kotlin-android plugin (KGP) unnecessary and causing build failures when applied. This PR migrates the plugin to support both AGP 8 (KGP) and AGP 9+ (built-in Kotlin) conditionally. Changes: - android/build.gradle: KGP applied only when AGP < 9 - android/build.gradle: kotlinOptions replaced with kotlin.compilerOptions - example/android/app/build.gradle: removed kotlin-android plugin - example/android/app/build.gradle: kotlinOptions replaced with kotlin.compilerOptions - example/android/settings.gradle: removed kotlin-android plugin declaration Follows the official Flutter migration guide: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors Fixes Tkko#45
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.
Summary
AGP 9.0 ships built-in Kotlin support, making the standalone
kotlin-androidplugin (KGP) unnecessary and causing build failures when applied on AGP 9+ (Cannot add extension with name 'kotlin', as there is an extension already registered with that name).This PR migrates the plugin to support both AGP 8 (KGP) and AGP 9+ (built-in Kotlin) conditionally, following the official Flutter migration guide for plugin authors.
Changes
android/build.gradleagpMajor < 9;kotlinOptions→kotlin { compilerOptions {} }example/android/app/build.gradlekotlin-androidplugin;kotlinOptions→kotlin { compilerOptions {} }example/android/settings.gradleorg.jetbrains.kotlin.androidplugin declarationpubspec.yamlCHANGELOG.mdBackward compatibility
Fixes #45