Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ further migration.
First, find the `kotlin-android` plugin (or the `org.jetbrains.kotlin.android`
plugin).
It is likely located in the `plugins` block of the
`<app-src>/android/build.gradle` or the
`<app-src>/android/build.gradle.kts` file.
`<app-src>/android/app/build.gradle` or the
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The PR title indicates a fix for the 'Kotlin migration guide', but it currently only updates for-app-developers.md. The for-plugin-authors.md file in the same directory also contains incorrect paths (e.g., using <app-src> instead of <plugin-project> and missing the correct directory structure) and should be updated to ensure the entire guide is accurate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Irrelevant. Path is good for plugin.

`<app-src>/android/app/build.gradle.kts` file.
If you use the legacy `apply` syntax, it will be located in
the Groovy-based `<app-src>/android/build.gradle` file, as this syntax is
the Groovy-based `<app-src>/android/app/build.gradle` file, as this syntax is
not supported in Kotlin DSL.

The following examples demonstrate how to migrate a Flutter Android app
Expand All @@ -68,7 +68,7 @@ and an add-to-app Android host app:

**Before**:

```kotlin title="<app-src>/android/build.gradle(.kts)"
```kotlin title="<app-src>/android/app/build.gradle(.kts)"
plugins {
id("com.android.application")
id("kotlin-android")
Expand All @@ -88,7 +88,7 @@ android {

Next, remove the `kotlin-android` plugin and the `kotlinOptions` block:

```kotlin diff title="<app-src>/android/build.gradle.kts"
```kotlin diff title="<app-src>/android/app/build.gradle.kts"
plugins {
id("com.android.application")
- id("kotlin-android")
Expand All @@ -106,7 +106,7 @@ Next, remove the `kotlin-android` plugin and the `kotlinOptions` block:

Add the `kotlin.compilerOptions{}` DSL block with the following:

```kotlin diff title="<app-src>/android/build.gradle.kts"
```kotlin diff title="<app-src>/android/app/build.gradle.kts"
+ kotlin {
+ compilerOptions {
+ jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
Expand All @@ -118,7 +118,7 @@ Here is how the file will likely end up:

**After**:

```kotlin title="<app-src>/android/build.gradle(.kts)"
```kotlin title="<app-src>/android/app/build.gradle(.kts)"
plugins {
id("com.android.application")
// ...
Expand All @@ -142,7 +142,7 @@ kotlin {

**Before**:

```groovy title="<app-src>/android/build.gradle"
```groovy title="<app-src>/android/app/build.gradle"
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
// ...
Expand All @@ -160,7 +160,7 @@ android {

Next, remove the `kotlin-android` plugin and the `kotlinOptions` block:

```groovy diff title="<app-src>/android/build.gradle"
```groovy diff title="<app-src>/android/app/build.gradle"
apply plugin: 'com.android.application'
- apply plugin: 'kotlin-android'
// ...
Expand All @@ -175,7 +175,7 @@ Next, remove the `kotlin-android` plugin and the `kotlinOptions` block:
```
Add the `kotlin.compilerOptions{}` DSL block with the following:

```groovy diff title="<app-src>/android/build.gradle"
```groovy diff title="<app-src>/android/app/build.gradle"
+ kotlin {
+ compilerOptions {
+ jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
Expand All @@ -187,7 +187,7 @@ Here is how the file will likely end up:

**After**:

```groovy title="<app-src>/android/build.gradle"
```groovy title="<app-src>/android/app/build.gradle"
apply plugin: 'com.android.application'
// ...

Expand Down Expand Up @@ -215,7 +215,7 @@ Therefore, only the `plugins {}` block instructions are included.

**Before**:

```kotlin title="<app-src>/android/build.gradle(.kts)"
```kotlin title="<app-src>/android/app/build.gradle(.kts)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For add-to-app host apps, the project structure is typically that of a native Android project where the app module is located directly in the app/ directory of the project root. Therefore, the path should be <host-app-project>/app/build.gradle(.kts) instead of <app-src>/android/app/build.gradle(.kts). This also maintains consistency with the placeholder used on line 37.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to my edit.

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
Expand All @@ -235,7 +235,7 @@ android {

Next, remove the `kotlin-android` plugin and the `kotlinOptions` block:

```kotlin diff title="<app-src>/android/build.gradle.kts"
```kotlin diff title="<app-src>/android/app/build.gradle.kts"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

As noted in the previous comment, for add-to-app host apps, the path should be <host-app-project>/app/build.gradle.kts to reflect the standard native Android project structure and maintain consistency with the <host-app-project> placeholder.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to my edit.

plugins {
alias(libs.plugins.android.application)
- alias(libs.plugins.kotlin.android)
Expand All @@ -252,7 +252,7 @@ Next, remove the `kotlin-android` plugin and the `kotlinOptions` block:
```
Add the `kotlin.compilerOptions{}` DSL block with the following:

```kotlin diff title="<app-src>/android/build.gradle.kts"
```kotlin diff title="<app-src>/android/app/build.gradle.kts"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

As noted in the previous comments, for add-to-app host apps, the path should be <host-app-project>/app/build.gradle.kts to reflect the standard native Android project structure and maintain consistency with the <host-app-project> placeholder.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to my edit.

+ kotlin {
+ compilerOptions {
+ jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
Expand All @@ -264,7 +264,7 @@ Here is how the file will likely end up:

**After**:

```kotlin title="<app-src>/android/build.gradle(.kts)"
```kotlin title="<app-src>/android/app/build.gradle(.kts)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

As noted in the previous comments, for add-to-app host apps, the path should be <host-app-project>/app/build.gradle(.kts) to reflect the standard native Android project structure and maintain consistency with the <host-app-project> placeholder.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to my edit.

plugins {
alias(libs.plugins.android.application)
// ...
Expand Down
Loading