Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## NEXT
## 2.4.24

* Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.
- Migrates to built-in Kotlin
Comment on lines +1 to +3
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.


## 2.4.23

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand All @@ -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 {
Expand Down Expand Up @@ -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
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
    }
}