Commit d031c3f
authored
chore(android): support AGP 9 built-in Kotlin (#1102)
## Summary
Migrates the Android plugin to AGP 9's built-in Kotlin while keeping
older toolchains building (same pattern as
flutter-webrtc/flutter-webrtc#2075):
- Apply the **Kotlin Gradle Plugin only when built-in Kotlin is
inactive** — AGP < 9, or AGP 9 with `android.builtInKotlin=false` (the
configuration Flutter currently ships by default while the ecosystem
migrates). When AGP 9's built-in Kotlin is active it registers the
`kotlin` extension itself and rejects KGP, so applying it is skipped.
- Set the JVM target through the `kotlin { compilerOptions {} }` DSL
**when the extension supports it** (KGP 1.9+ / AGP 9 built-in Kotlin),
falling back to the legacy `kotlinOptions` DSL for apps still on KGP
1.8.x.
- Bump the standalone buildscript fallback KGP to 2.1.0 so it is
self-consistent.
- Add a changeset entry for the generated release notes.
## Context
AGP 9 uses built-in Kotlin support and rejects Android plugins that
still apply KGP directly. This follows the Flutter compatibility
migration path instead of raising the minimum supported toolchain.
## Verification
- Example app builds (`flutter build apk --debug`) on the current stable
toolchain (AGP 8.x + modern KGP path).
- The AGP 9 built-in path mirrors the reviewed and merged flutter-webrtc
implementation.1 parent b6cc65d commit d031c3f
2 files changed
Lines changed: 30 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
26 | 37 | | |
27 | 38 | | |
28 | 39 | | |
| |||
36 | 47 | | |
37 | 48 | | |
38 | 49 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
| |||
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
0 commit comments