5kmrun-bg / 5kmrun-bg/fivekmrun-app
Android: plugins still apply the Kotlin Gradle Plugin — blocks built-in Kotlin, will break future Flutter
- Langage dominant
- Dart
- Étoiles
- 8
- Forks
- 7
- Merge moyen
- 2 j 8 h
- PR mergées (30 j)
- 30
Description
## Problem
Since the AGP 9 upgrade (#248), every Android build warns that our plugins still apply the **Kotlin Gradle Plugin (KGP)**, which AGP 9 no longer needs and which Flutter is actively removing support for:
> WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): `add_to_google_wallet`, `app_badge_plus`, `firebase_analytics`, `firebase_core`, `firebase_crashlytics`, `firebase_remote_config`, `flutter_web_auth_2`, `mobile_scanner`, `rate_my_app`, `shared_preferences_android`
>
> **Future versions of Flutter will fail to build if your app uses plugins that apply KGP.**
AGP itself adds, per project:
> The `org.jetbrains.kotlin.android` plugin in project `:app` is no longer required for Kotlin support since AGP 9.0.
> Solution: Remove both `android.builtInKotlin=true` and `android.newDsl=false` from `gradle.properties`, then migrate to built-in Kotlin.
This is a **latent blocker**, not a current breakage. Builds are green today. It is filed so it is not rediscovered under time pressure when a Flutter upgrade suddenly fails.
## Why we cannot fix it yet
The migration is gated on upstream plugin releases, not on us. As of today, **8 of the 10 plugins are already at their latest published version**:
| Plugin | Current | Latest | Upgrade available? |
|---|---|---|---|
| `add_to_google_wallet` | 0.0.5 | 0.0.5 | no |
| `app_badge_plus` | 1.3.4 | 1.3.4 | no |
| `firebase_analytics` | 12.5.0 | 12.5.0 | no |
| `firebase_core` | 4.14.0 | 4.14.0 | no |
| `firebase_crashlytics` | 5.3.0 | 5.3.0 | no |
| `firebase_remote_config` | 6.6.0 | 6.6.0 | no |
| `flutter_web_auth_2` | 5.0.3 | **5.1.0** | yes |
| `mobile_scanner` | 7.4.0 | 7.4.0 | no |
| `rate_my_app` | 2.4.1 | 2.4.1 | no |
| `shared_preferences_android` | 2.4.7 | **2.4.28** | yes |
So there is no version of the Firebase suite, `mobile_scanner`, `rate_my_app`, `add_to_google_wallet` or `app_badge_plus` that drops KGP yet. Upgrading is not an option we are declining — it does not exist.
## Our own app module
`android/app/build.gradle` also applies `org.jetbrains.kotlin.android` directly, and Flutter warns about that separately:
> Your Android app project ... applies the Kotlin Gradle Plugin, which will cause build failures in future versions of Flutter.
This half **is** in our control, but migrating the app module alone does not silence the plugin warnings, and `android.builtInKotlin` / `android.newDsl` are global switches — so it is not worth doing piecemeal ahead of the plugins.
## Work, when it becomes possible
- Check whether `flutter_web_auth_2` **5.1.0** and `shared_preferences_android` **2.4.28** already drop KGP — the two upgrades available today, and the cheapest way to shrink the list. (Note `shared_preferences_android` is transitive; it moves with `shared_preferences`.)
- Track the Firebase suite and `mobile_scanner` for built-in Kotlin support; these are the ones most likely to move first, being actively maintained.
- Assess the unmaintained ones separately — `add_to_google_wallet` (0.0.5) and `app_badge_plus` are the likeliest to never migrate, and may need replacing or inlining. #222 already flags a similar list of latent-blocker dependencies.
- Once all plugins are clear: remove `org.jetbrains.kotlin.android` from `android/app/build.gradle`, drop `android.builtInKotlin=false` and `android.newDsl=false` from `android/gradle.properties`, and migrate to built-in Kotlin.
Guides: [for app developers](https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-app-developers) · [for plugin authors](https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors) · [AGP built-in Kotlin](https://kotl.in/gradle/agp-built-in-kotlin)
## Deadlines
- **AGP 10** removes `android.builtInKotlin` and `android.newDsl` (both are already deprecation-warned).
- **Flutter**: no specific release named yet — "future versions will fail to build". Same pattern as the `rate_my_app` / SPM warning noted in #222, which stayed harmless until it suddenly was not.
## Acceptance criteria
- [ ] No plugin in the dependency tree applies KGP
- [ ] `org.jetbrains.kotlin.android` removed from `android/app/build.gradle`
- [ ] `android.builtInKotlin` / `android.newDsl` removed from `android/gradle.properties`
- [ ] Android builds produce no KGP or built-in-Kotlin warnings
- [ ] Release build device-verified — this changes how Kotlin is compiled
## Notes
Do not force this before upstream is ready; there is no benefit to a partial migration, and the warnings are harmless today. Revisit when a Flutter release names the version that will break, or when the Firebase suite ships built-in Kotlin support.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.