Skip to content

Conversation

@jesswrd
Copy link
Contributor

@jesswrd jesswrd commented Feb 9, 2026

This PR contains auditing work for AGP 9 for plugins. The objective is to identify the changes required to build a Flutter app with plugins on Android AGP 9, and to determine which of those configurations maintain backward compatibility with older AGP versions. Ideally, we could identify one set of changes that could succeessfully build on apps on AGP 9 and is also backwards compatible.

The main migration steps required for AGP 9:

  1. Using new agp DSL (we can't do this yet due to usage of internal AGP apis. must opt out with android.newDsl=false)
  2. Use built-in Kotlin

The first migration step is backwards compatible. Some of the required changes in the second migration step are backwards compatible while others are not. In this approach, the non compatible is made backwards compatible with an if-statement.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

Comment on lines +49 to 53
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Flutter apps on Android successfully build on AGP 9 and versions before AGP 9 when using kotlin.compilerOptions{} DSL. This is because the usage of kotlinOptions{} and kotlin.compilerOptions{} DSL is dependent on the KGP version and not the AGP version.

Some context: apparently kotlinOptions{} DSL has been deprecated since KGP 2.0.0 and it is recommended that kotlin.compilerOptions{} DSL be used instead here.

@@ -1,2 +1,3 @@
org.gradle.jvmargs=-Xmx4G
android.useAndroidX=true
android.newDsl=false No newline at end of file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even though android.newDsl=false was introduced in AGP 9, it looks like the android.newDsl can successfully build on versions older than AGP 9.

@jesswrd jesswrd reopened this Feb 10, 2026
@fluttergithubbot
Copy link

An existing Git SHA, a3a08efe2c80c8a5b6ae9e59cd0dc7c70f858dd6, was detected, and no actions were taken.

To re-trigger presubmits after closing or re-opeing a PR, or pushing a HEAD commit (i.e. with --force) that already was pushed before, push a blank commit (git commit --allow-empty -m "Trigger Build") or rebase to continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants