Skip to content

Migrate shared_preferences_android to built-in Kotlin#11767

Open
faisalansari0367 wants to merge 2 commits into
flutter:mainfrom
faisalansari0367:migrate/built-in-kotlin-android
Open

Migrate shared_preferences_android to built-in Kotlin#11767
faisalansari0367 wants to merge 2 commits into
flutter:mainfrom
faisalansari0367:migrate/built-in-kotlin-android

Conversation

@faisalansari0367
Copy link
Copy Markdown

Removes explicit Kotlin Gradle Plugin dependency and migrates to Flutter's built-in Kotlin support per the breaking-changes migration guide.

- Remove explicit kotlin-gradle-plugin dependency
- Remove kotlin-android plugin application
- Update to use Flutter's built-in Kotlin support

Fixes Flutter warning about plugins applying KGP
@flutter-dashboard
Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates the Android shared preferences plugin to built-in Kotlin support and updates the version to 2.4.24. Feedback suggests removing a redundant legacy Kotlin configuration block to ensure compatibility with AGP 9+ and restoring a removed changelog entry regarding the minimum supported SDK version.

Comment on lines +94 to +98
project.extensions.configure(org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension::class.java) {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This block correctly implements the recommended way to configure Kotlin for the built-in support migration. However, it is currently redundant because the jvmTarget is also configured in the kotlin { ... } block at lines 40-44.

To follow the migration guide correctly and avoid potential build failures on AGP 9+ (where the kotlin DSL extension might not be available), you should remove the existing kotlin block at lines 40-44 and keep this project.extensions.configure block.

Additionally, since JvmTarget is already imported at line 1, you can use the simplified name.

project.extensions.configure(org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension::class.java) {
    compilerOptions {
        jvmTarget = JvmTarget.JVM_17
    }
}

Comment on lines +1 to +3
## 2.4.24

* Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.
- Migrates to built-in Kotlin
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The changelog entry for the minimum supported SDK version update (Flutter 3.38/Dart 3.10) from the NEXT section has been removed. If this change is intended to be included in version 2.4.24, it should be preserved alongside the Kotlin migration entry.

Suggested change
## 2.4.24
* Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.
- Migrates to built-in Kotlin
## 2.4.24
- Migrates to built-in Kotlin
- Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant