Repository navigation
Conversation
AGP 9 compiles Kotlin itself (built-in Kotlin, on by default) and fails
the build when a library subproject applies the Kotlin Gradle Plugin:
The 'org.jetbrains.kotlin.android' plugin is no longer required for
Kotlin support since AGP 9.0.
Flutter 3.47 additionally lists survicate_sdk under "plugins that apply
Kotlin Gradle Plugin (KGP)" and warns that future releases will stop
building such plugins.
- Apply KGP only when built-in Kotlin is not in effect: on AGP 8, or on
AGP 9+ when the app sets android.builtInKotlin=false explicitly. The
property is checked for presence, not truthiness, so the documented
opt-out is honoured, and the same boolean gates kotlinOptions (KGP
path) and kotlin.compilerOptions (built-in path). Using
pluginManager.apply(...) keeps Flutter's text-based KGP check from
flagging the plugin.
- compileSdkVersion 34 -> 35: survicate-sdk 9.0.1 pulls in
androidx.recyclerview 1.4.0, which requires consumers to compile
against API 35; AGP 9 enforces this in checkReleaseAarMetadata
("survicate_sdk is currently compiled against android-34").
No Dart, native or pubspec changes; the minimum Flutter version is
unchanged.
Collaborator
|
Thanks for the PR and the detailed investigation! We reproduced both issues, but we’ve decided to handle the fix internally, so we won’t be merging this PR. We’ll keep support for older Flutter versions and document the remaining warning instead of working around Flutter’s detection, following the Flutter team’s guidance. Thanks again for helping us track this down. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes
survicate_sdkbuild on Android Gradle Plugin 9 while keeping the existing Kotlin Gradle Plugin (KGP) path for AGP 8. Onlyandroid/build.gradlechanges; no Dart, native or pubspec changes, and the minimum Flutter version is unchanged.Why
AGP 9 compiles Kotlin itself ("built-in Kotlin", on by default) and fails the build when a library subproject applies KGP:
Flutter 3.47 also lists
survicate_sdkin its "plugins that apply Kotlin Gradle Plugin (KGP)" warning and says future Flutter releases will stop building such plugins (https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors).Separately, on AGP 9 the plugin fails its AAR metadata check even with built-in Kotlin disabled:
recyclerview 1.4.0 comes in through
com.survicate:survicate-sdk:9.0.1.How
android.builtInKotlin=false. The property is checked for presence, not truthiness, so that opt-out is honoured and AGP 8 behaviour is unchanged whatever the property says.pluginManager.apply(...)instead ofapply plugin:keeps Flutter's text-based KGP check from flagging the plugin.kotlinOptions { jvmTarget = '1.8' }stays on the KGP path;kotlin { compilerOptions { jvmTarget = JVM_1_8 } }is added for the built-in path, matchingcompileOptions.compileSdkVersion 34→35.This is the same pattern used by wakelock_plus and currently proposed for image_editor (fluttercandies/flutter_image_editor#164) and pdfx (ScerIO/packages.flutter#657).
Truth table (Gradle 9.3.1 / Groovy 4.0.29, AGP major injected)
android.builtInKotlinkotlinOptionscompilerOptionsReal builds (Flutter 3.47.9)
builtInKotlin=trueexample/(AGP/KGP/Gradle bumped locally,kotlin-androidremoved from the app module)BUILD SUCCESSFUL,:survicate_sdk:compileDebugKotlinran, no KGP warningbuiltInKotlin=falsedependency_overridessurvicate_sdkno longer in Flutter's "plugins that apply KGP" listexample/BUILD SUCCESSFUL,:survicate_sdk:compileDebugKotlinran, no KGP warning. Needed--android-skip-build-dependency-validation, Gradle 8.14.3 and a 4 GB heap only because Flutter 3.47 rejects the example's AGP 8.7.3 / Gradle 8.9 and its 1.5 GBjvmargsis too small for Jetifier; unrelated to this changeThe example app and CHANGELOG are left untouched so this fits your release flow; happy to add a changelog entry or bump the example to AGP 9 if you prefer that in the same PR.
🤖 Generated with Claude Code