Description
The wakelock_plus plugin applies the kotlin-android plugin in its android/build.gradle. Starting with AGP 9.0.0, built-in Kotlin is the default and applying the kotlin-android plugin causes a build failure:
Failed to apply plugin 'kotlin-android'.
> ⛔ Failed to apply plugin 'org.jetbrains.kotlin.android'
The 'org.jetbrains.kotlin.android' plugin is no longer required for Kotlin support since AGP 9.0.
Solution: Remove the 'org.jetbrains.kotlin.android' plugin from this project's build file.
Steps to reproduce
- Create or migrate a Flutter project to AGP 9.0.0 following https://docs.flutter.dev/release/breaking-changes/migrate-to-agp-9
- Add
wakelock_plus as a dependency
- Run
flutter build apk --debug
- Build fails with the error above
Current workaround
Set android.builtInKotlin=false in gradle.properties and re-add the kotlin-android plugin to the app's build.gradle. This is a temporary escape hatch that will be removed before AGP 10.0.
Expected fix
Remove id("kotlin-android") from the plugin's android/build.gradle — AGP 9's built-in Kotlin handles Kotlin compilation without a separate plugin.
Environment
- wakelock_plus: 1.4.0
- Flutter: 3.38.9
- Dart: 3.10.8
- AGP: 9.0.0
- Gradle: 9.3.1
Related issues
Description
The
wakelock_plusplugin applies thekotlin-androidplugin in itsandroid/build.gradle. Starting with AGP 9.0.0, built-in Kotlin is the default and applying thekotlin-androidplugin causes a build failure:Steps to reproduce
wakelock_plusas a dependencyflutter build apk --debugCurrent workaround
Set
android.builtInKotlin=falseingradle.propertiesand re-add thekotlin-androidplugin to the app'sbuild.gradle. This is a temporary escape hatch that will be removed before AGP 10.0.Expected fix
Remove
id("kotlin-android")from the plugin'sandroid/build.gradle— AGP 9's built-in Kotlin handles Kotlin compilation without a separate plugin.Environment
Related issues