[Bug]: AGP 9 incompatibility — kotlin-android plugin must be removed
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- android, dart
- Domain
- build-system, mobile-dev
Research direction
The affected file is android/build.gradle. Start by inspecting the plugin declarations there and reproduce the failure with flutter build apk --debug under AGP 9.0.0. Done means the kotlin-android plugin is no longer applied and the Android build succeeds without the workaround.
Written by the indexing model from the issue text.
Description
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_plusas 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
- Flutter tracking: https://github.com/flutter/flutter/issues/181383
- Flutter migration guide: https://docs.flutter.dev/release/breaking-changes/migrate-to-agp-9
- Similar issue on plus_plugins: https://github.com/fluttercommunity/plus_plugins/issues/3745
- Dominant language
- Dart
- Stars
- 110
- Forks
- 97
- Avg merge
- 5d 4h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fluttercommunity/wakelock_plus
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
window不能编译 Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
enhancement
fluttercommunity/wakelock_plus#110 · 1 assignee ·
All issues in fluttercommunity/wakelock_plus
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
code quality good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Suwayomi/Suwayomi-Tsumiru#479 ·
-
Build Failure: agora_rtc_engine compiled against android-31 while dependencies require android-34+ Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
conceptadev/noir#95 ·