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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#### 3.3.0 · 8/18/2026

- Migrated to Flutter's built-in Kotlin support for AGP 9+ compatibility
- KGP (`kotlin-android`) is now applied conditionally only on AGP < 9
- `kotlinOptions` replaced with `kotlin { compilerOptions {} }` DSL
- See: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors
- Fixes [#45](https://github.com/Tkko/flutter_smart_auth/issues/45)

#### 3.2.0 · 1/1/2025

- Fixed method type
Expand Down
22 changes: 18 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ rootProject.allprojects {
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

// AGP 9+ ships built-in Kotlin support; only apply KGP when built-in Kotlin is
// not in effect (older AGP, or projects opting out via android.builtInKotlin=false).
// See: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors
def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int
def builtInKotlin = agpMajor >= 9 && project.findProperty('android.builtInKotlin') != 'false'
if (!builtInKotlin) {
apply plugin: 'kotlin-android'
}

android {
// Conditional for compatibility with AGP <4.2.
Expand All @@ -37,12 +45,18 @@ android {
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = '11'
// android.kotlinOptions only exists when KGP is applied; with AGP 9 built-in
// Kotlin, jvmTarget follows compileOptions.targetCompatibility.
if (!builtInKotlin) {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
// Kotlin sources must go to the kotlin source set; AGP 9 built-in Kotlin
// does not compile Kotlin files added to the java source set.
main.kotlin.directories.add('src/main/kotlin')
}

defaultConfig {
Expand Down
15 changes: 9 additions & 6 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
// AGP 9+ has built-in Kotlin support; kotlin-android plugin removed
// The Flutter Gradle Plugin must be applied after the Android Gradle plugin.
id "dev.flutter.flutter-gradle-plugin"
}

Expand All @@ -15,10 +15,6 @@ android {
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = '11'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "fman.ge.smart_auth_example"
Expand All @@ -39,6 +35,13 @@ android {
}
}

// AGP 9+ built-in Kotlin: kotlinOptions migrated to kotlin.compilerOptions
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
}
}

flutter {
source = "../.."
}
1 change: 0 additions & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.3.2" apply false
id "org.jetbrains.kotlin.android" version "1.8.0" apply false
}

include ":app"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: smart_auth
description: Wrapper of Android SMS User Consent API, SMS Retriever API to read one time sms code, get user phone number, OTP, OTC, sms autofill, android autofill
homepage: https://github.com/Tkko/flutter_smart_auth
repository: https://github.com/Tkko/flutter_smart_auth
version: 3.2.0
version: 3.3.0
topics:
- otp
- sms-autofill
Expand Down