-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Migrate shared_preferences_android to built-in Kotlin #11767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,15 +4,13 @@ group = "io.flutter.plugins.sharedpreferences" | |
| version = "1.0-SNAPSHOT" | ||
|
|
||
| buildscript { | ||
| val kotlinVersion = "2.3.0" | ||
| repositories { | ||
| google() | ||
| mavenCentral() | ||
| } | ||
|
|
||
| dependencies { | ||
| classpath("com.android.tools.build:gradle:8.13.1") | ||
| classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -31,7 +29,12 @@ tasks.withType<JavaCompile>().configureEach { | |
|
|
||
| plugins { | ||
| id("com.android.library") | ||
| id("kotlin-android") | ||
| } | ||
|
|
||
| val agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.substringBefore('.').toInt() | ||
|
|
||
| if (agpMajor < 9) { | ||
| apply(plugin = "org.jetbrains.kotlin.android") | ||
| } | ||
|
|
||
| kotlin { | ||
|
|
@@ -87,3 +90,9 @@ android { | |
| } | ||
| } | ||
| } | ||
|
|
||
| project.extensions.configure(org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension::class.java) { | ||
| compilerOptions { | ||
| jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 | ||
| } | ||
| } | ||
|
Comment on lines
+94
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This block correctly implements the recommended way to configure Kotlin for the built-in support migration. However, it is currently redundant because the To follow the migration guide correctly and avoid potential build failures on AGP 9+ (where the Additionally, since project.extensions.configure(org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension::class.java) {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
}
} |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changelog entry for the minimum supported SDK version update (Flutter 3.38/Dart 3.10) from the
NEXTsection has been removed. If this change is intended to be included in version2.4.24, it should be preserved alongside the Kotlin migration entry.