Skip to content

fix(android): support AGP 9 built-in Kotlin - #477

Open
453zhangqiang-star wants to merge 1 commit into
AppsFlyerSDK:masterfrom
453zhangqiang-star:fix/agp9-built-in-kotlin
Open

453zhangqiang-star wants to merge 1 commit into
AppsFlyerSDK:masterfrom
453zhangqiang-star:fix/agp9-built-in-kotlin

Conversation

@453zhangqiang-star

Copy link
Copy Markdown

What

Migrate the Android build so it supports AGP 9 built-in Kotlin, while keeping the legacy
Kotlin Gradle Plugin (KGP) path working for older AGP versions.

Why

AGP 9 enables built-in Kotlin and no longer allows library subprojects to apply the
Kotlin Gradle Plugin. Flutter documents this migration and warns about plugins that
still apply KGP; future Flutter versions will fail to build them:

The same pattern has already been merged upstream in flutter_timezone 5.1.1,
wakelock_plus 1.7.0+, and sign_in_with_apple 8.2.0.

How

  • Apply KGP only when built-in Kotlin is not in effect (agpMajor < 9 || android.builtInKotlin != true).
  • Use pluginManager.apply(...) instead of apply plugin:, so Flutter's static KGP
    detection (which pattern-matches build file text) does not flag the plugin.
  • Keep kotlinOptions on the legacy path; use kotlin.compilerOptions when built-in
    Kotlin is active.
  • The minimum-Kotlin version check now runs only on the legacy path; with built-in Kotlin the check is skipped (the host no longer applies KGP).

No Dart or native API changes.

Testing

Build-configuration only; no behavior change on the legacy path.
I have not run this repo's example app build yet — happy to run it on request, or you can
trigger CI. Please tell me if you prefer a different structure and I will adjust.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants