-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Added warning against migration to built-in kotlin #13634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5602a88
560fb28
2026164
7f67bbf
3111461
8679640
b3605d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,23 @@ an AGP version created before 9.0.0 to an AGP version 9.0.0+. | |||||||||
| You should also use the minimum compatible dependency versions | ||||||||||
| listed in the [Android Gradle Plugin docs][AGP block]. | ||||||||||
|
|
||||||||||
| :::warning | ||||||||||
| This guide only applies to apps that already use the | ||||||||||
| Kotlin Gradle Plugin (KGP). | ||||||||||
|
|
||||||||||
| To verify whether your app applies KGP, | ||||||||||
| find the `kotlin-android` plugin | ||||||||||
| (or the `org.jetbrains.kotlin.android` plugin). | ||||||||||
| It is likely located in the | ||||||||||
| `<app-src>/android/app/build.gradle` or | ||||||||||
| `<app-src>/android/app/build.gradle.kts` file. | ||||||||||
| To view the KGP application code, | ||||||||||
| see [Update the Gradle file](#update-the-gradle-file). | ||||||||||
|
Comment on lines
+24
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The phrase 'KGP application code' can be confusing because 'application' is often interpreted as an Android application (app) rather than the act of applying a plugin. Consider rephrasing this to 'how KGP is applied' or 'examples of how KGP is applied' to improve clarity.
Suggested change
|
||||||||||
|
|
||||||||||
| If your app doesn't currently apply KGP, | ||||||||||
| don't migrate to built-in Kotlin. | ||||||||||
| ::: | ||||||||||
|
jesswrd marked this conversation as resolved.
|
||||||||||
|
|
||||||||||
| :::note | ||||||||||
| To update Flutter plugins to use built-in Kotlin, | ||||||||||
| follow the [migration guide for plugin authors][]. | ||||||||||
|
|
@@ -299,6 +316,8 @@ kotlin { | |||||||||
| Before enabling built-in Kotlin, | ||||||||||
| confirm that you have migrated your application | ||||||||||
| and any Flutter plugins it uses. | ||||||||||
| Also, confirm that you updated your app | ||||||||||
| to AGP 9+, because built-in Kotlin requires AGP 9+. | ||||||||||
|
|
||||||||||
| To enable built-in Kotlin, | ||||||||||
| set the `android.builtInKotlin` property to `true` | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,23 @@ description: >- | |||||||||
|
|
||||||||||
| This guide outlines the migration steps specifically for plugin authors. | ||||||||||
|
|
||||||||||
| :::warning | ||||||||||
| This guide only applies to plugins that already use the | ||||||||||
| Kotlin Gradle Plugin (KGP). | ||||||||||
|
|
||||||||||
| To verify whether your plugin applies KGP, | ||||||||||
| find the `kotlin-android` plugin | ||||||||||
| (or the `org.jetbrains.kotlin.android` plugin). | ||||||||||
| It is likely located in the | ||||||||||
| `<plugin-project>/android/build.gradle` or | ||||||||||
| `<plugin-project>/android/build.gradle.kts` file. | ||||||||||
| To view the KGP application code, | ||||||||||
| see [Update the Gradle file](#update-the-gradle-file). | ||||||||||
|
Comment on lines
+19
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The phrase 'KGP application code' is confusing here, especially for plugin authors, as 'application' typically refers to an Android application rather than the act of applying a plugin. Rephrasing this to 'how KGP is applied' or 'examples of how KGP is applied' would be much clearer.
Suggested change
|
||||||||||
|
|
||||||||||
| If your plugin project doesn't currently apply KGP, | ||||||||||
| don't migrate to built-in Kotlin. | ||||||||||
| ::: | ||||||||||
|
jesswrd marked this conversation as resolved.
|
||||||||||
|
|
||||||||||
| :::note | ||||||||||
| To update Flutter apps to use built-in Kotlin, | ||||||||||
| follow the [migration guide for app developers][]. | ||||||||||
|
|
@@ -24,9 +41,9 @@ follow the instructions to | |||||||||
| First, find the `kotlin-android` plugin | ||||||||||
| (or the `org.jetbrains.kotlin.android` plugin). | ||||||||||
| It is likely located in the `plugins` block of the | ||||||||||
| `<plugin-project>/build.gradle` or the `<plugin-project>/build.gradle.kts` file. | ||||||||||
| `<plugin-project>/android/build.gradle` or the `<plugin-project>/android/build.gradle.kts` file. | ||||||||||
| If you use the legacy `apply` syntax, | ||||||||||
| it will be located in the Groovy-based `<plugin-project>/build.gradle` file, | ||||||||||
| it will be located in the Groovy-based `<plugin-project>/android/build.gradle` file, | ||||||||||
| as this syntax isn't supported in Kotlin DSL. | ||||||||||
|
|
||||||||||
| The following examples demonstrate how to migrate a Flutter plugin: | ||||||||||
|
|
@@ -422,6 +439,8 @@ the newly released plugin version: | |||||||||
| Before enabling built-in Kotlin, | ||||||||||
| confirm that you have migrated your plugin example app | ||||||||||
| and any Flutter plugins it uses. | ||||||||||
| Also, confirm that you updated your plugin example app | ||||||||||
| to AGP 9+, because built-in Kotlin requires AGP 9+. | ||||||||||
|
|
||||||||||
| To enable built-in Kotlin, | ||||||||||
| set the `android.builtInKotlin` property to `true` | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the requirement to add
android.newDsl=falsementioned in the next section? Do apps that don't use KGP or add-to-app apps need to add that either way?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
android.newDsl=falseis completely separate from KGP/migrating to built-in kotlin. Whether or not an app is applying KGP,android.newDsl=falsemust be set to succesfully build an app using AGP 9. So there are technically two parts to successfully building on AGP 9:android.newDslisfalse(this only has to be manually set for add-to-app scenarios)This guide is specifically for those migrating to built-in kotlin. I do think the above^ is important to communicate. Any guidance for how to communicate it? (as a part of this guide? another doc?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification. I would consider creating an additional short and focused migration doc, potentially limited to the add-to-app scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I'll do that in a different change.