Migrate to built-in Kotlin#22
Conversation
Removes the legacy kotlin-android plugin apply and the Kotlin Gradle Plugin classpath from android/build.gradle, per the official Flutter migration guide at: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors Also migrates the example app (example/android/app/build.gradle and example/android/gradle.properties). Builds cleanly with flutter build apk --debug in the example app, no Kotlin Gradle Plugin deprecation warnings. Bumps minimum Flutter version to 3.44.0 and Dart SDK to 3.12.0 as required by the new compilerOptions DSL.
📝 WalkthroughWalkthroughThis PR releases version 2.2.0, which migrates the Kotlin build configuration to use AGP 9.0's built-in Kotlin support instead of the legacy Kotlin Gradle plugin. It raises minimum Dart/Flutter SDK versions, updates the library and example app build configurations, and increases JVM heap allocation in the example app. ChangesKotlin/AGP 9.0 Migration and v2.2.0 Release
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request migrates the project to built-in Kotlin for AGP 9.0 compatibility by removing the legacy Kotlin Gradle Plugin and updating the JVM target configuration to use the new Kotlin compiler options. It also adjusts Gradle properties and updates dependency constraints. Feedback on these changes suggests wrapping the kotlin configuration block in plugins.withId('org.jetbrains.kotlin.android') to prevent build failures in consuming apps that have not yet migrated, and reducing the Gradle heap size allocation in gradle.properties from 8G to a more reasonable limit to avoid out-of-memory issues on CI/CD runners.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| kotlin { | ||
| compilerOptions { | ||
| jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 | ||
| } | ||
| } |
There was a problem hiding this comment.
If a consuming app has not yet migrated to built-in Kotlin (i.e., they do not have android.builtInKotlin=true in their gradle.properties), the kotlin extension will not be registered on this project. This will cause the build to fail with a MissingMethodException when trying to evaluate the kotlin block.
To make this configuration safe and backward-compatible, wrap the kotlin block inside plugins.withId('org.jetbrains.kotlin.android'). This ensures the block is only evaluated if the Kotlin plugin is actually applied.
plugins.withId('org.jetbrains.kotlin.android') {
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
}
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@example/android/gradle.properties`:
- Line 1: The org.gradle.jvmargs setting is over-provisioned (-Xmx8G) and can
prevent the Gradle daemon from starting on typical 4–6GB machines; change the
default in the gradle.properties entry named org.gradle.jvmargs to a safer
memory cap (e.g., -Xmx2G with existing metaspace and code cache flags preserved)
and rely on local overrides for higher-memory environments so CI/dev machines
won't fail to start the daemon.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2fccb7a6-ca61-44e4-a981-5559ddd71ae4
📒 Files selected for processing (5)
CHANGELOG.mdandroid/build.gradleexample/android/app/build.gradleexample/android/gradle.propertiespubspec.yaml
Migrates the plugin to use built-in Kotlin per the official Flutter
migration guide:
https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors
AGP 9.0 will remove support for plugins that apply the Kotlin Gradle
Plugin. This PR removes the legacy
apply plugin: "kotlin-android"line and the KGP classpath from
android/build.gradle, and the samefrom the example app's
example/android/app/build.gradle.The example app builds cleanly with
flutter build apk --debugonFlutter 3.44.1 with no KGP deprecation warnings.
Bumps the minimum Flutter version to 3.44.0 and Dart SDK to 3.12.0,
as required by the new
kotlin.compilerOptionsDSL.Fixes the warning: "Your app uses the following plugins that apply
Kotlin Gradle Plugin (KGP)".
Summary by CodeRabbit
Release Notes - Version 2.2.0
Chores
Documentation