fix: apply kotlin-android plugin explicitly for KGP 2.x compatibility#25
Open
lalpix wants to merge 1 commit into
Open
fix: apply kotlin-android plugin explicitly for KGP 2.x compatibility#25lalpix wants to merge 1 commit into
lalpix wants to merge 1 commit into
Conversation
kotlinOptions {} in the android {} block requires the Kotlin Android
plugin to be applied. Previously this worked implicitly via the Flutter
tooling, but Kotlin Gradle Plugin 2.x no longer registers the
kotlinOptions extension on android {} unless kotlin-android is applied
explicitly. The jvmTarget is now set via compileOptions sourceCompatibility
which AGP propagates automatically.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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.
Problem
kotlinOptions {}inside theandroid {}block requires the Kotlin Android plugin (kotlin-android) to be applied. Previously this worked implicitly via Flutter tooling, but Kotlin Gradle Plugin 2.x no longer registers thekotlinOptionsextension on theandroidextension unless the plugin is explicitly applied.This causes the following build error when using the package with KGP 2.0+:
Fix
kotlin-androidplugin inandroid/build.gradlekotlinOptionsblock —jvmTargetis already covered by thecompileOptionssourceCompatibilitysetting which AGP propagates to Kotlin automaticallyTested with