Summary
sign_in_with_apple's android/build.gradle still uses the pre-AGP-9 DSL, forcing every consumer on AGP 9 to keep both compatibility flags set:
android.builtInKotlin=false — because the plugin applies kotlin-android itself, which conflicts with AGP 9's built-in Kotlin support.
android.newDsl=false — because compileSdkVersion / minSdkVersion / script-style apply plugin: are old DSL.
Both flags are scheduled for removal in a future AGP release (DSL/API migration timeline), so plugin consumers can't move forward until this is fixed.
Environment
sign_in_with_apple: 8.0.0-spm.1 (current android/build.gradle on master is unchanged too)
- AGP 9.1.1, Gradle 9.5.0-rc-2, Flutter 3.41.6, JDK 21
Current android/build.gradle (excerpt)
Problematic lines marked // <-- ...:
buildscript {
ext.kotlin_version = '1.7.10'
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android' // <-- blocks android.builtInKotlin=true
android {
compileSdkVersion 34 // <-- blocks android.newDsl=true (use `compileSdk`)
if (project.android.hasProperty("namespace")) {
namespace 'com.aboutyou.dart_packages.sign_in_with_apple'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions { jvmTarget = '1.8' }
sourceSets { main.java.srcDirs += 'src/main/kotlin' }
defaultConfig {
minSdkVersion 16 // <-- blocks android.newDsl=true (use `minSdk`)
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lint { disable 'InvalidPackage' }
}
Suggested fix — backward-compatible conditional migration
Keeps AGP 7/8 working while letting AGP 9 users drop both compat flags. compileSdk / minSdk (without the Version suffix) work from AGP 7+, so the DSL change is safe. The kotlin-android plugin is only applied when AGP isn't providing Kotlin itself.
group 'com.aboutyou.dart_packages.sign_in_with_apple'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.9.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
// AGP 9 supplies Kotlin via `android.builtInKotlin=true` (default on AGP 9).
// For older AGP or when the flag is explicitly disabled, apply kotlin-android manually.
def builtInKotlin = project.findProperty('android.builtInKotlin')
if (builtInKotlin == null || builtInKotlin.toString() == 'false') {
apply plugin: 'kotlin-android'
}
android {
if (project.android.hasProperty("namespace")) {
namespace 'com.aboutyou.dart_packages.sign_in_with_apple'
}
compileSdk 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdk 21
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lint {
disable 'InvalidPackage'
}
}
dependencies {
implementation "androidx.browser:browser:1.5.0"
}
Changes vs. current:
compileSdkVersion 34 → compileSdk 34
minSdkVersion 16 → minSdk 21 (minSdk 16 is below Flutter's current floor anyway — feel free to keep 16 if wider support is desired)
- Conditional
apply plugin: 'kotlin-android' guarded by the android.builtInKotlin property
kotlin_version bumped 1.7.10 → 1.9.0 (AGP 9 requires Kotlin 1.9+); drop the explicit kotlin-stdlib-jdk7 dep since AGP-provided Kotlin brings its own stdlib
Happy to open a PR if helpful.
Summary
sign_in_with_apple'sandroid/build.gradlestill uses the pre-AGP-9 DSL, forcing every consumer on AGP 9 to keep both compatibility flags set:android.builtInKotlin=false— because the plugin applieskotlin-androiditself, which conflicts with AGP 9's built-in Kotlin support.android.newDsl=false— becausecompileSdkVersion/minSdkVersion/ script-styleapply plugin:are old DSL.Both flags are scheduled for removal in a future AGP release (DSL/API migration timeline), so plugin consumers can't move forward until this is fixed.
Environment
sign_in_with_apple: 8.0.0-spm.1(currentandroid/build.gradleonmasteris unchanged too)Current
android/build.gradle(excerpt)Problematic lines marked
// <-- ...:buildscript { ext.kotlin_version = '1.7.10' dependencies { classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } apply plugin: 'com.android.library' apply plugin: 'kotlin-android' // <-- blocks android.builtInKotlin=true android { compileSdkVersion 34 // <-- blocks android.newDsl=true (use `compileSdk`) if (project.android.hasProperty("namespace")) { namespace 'com.aboutyou.dart_packages.sign_in_with_apple' } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { minSdkVersion 16 // <-- blocks android.newDsl=true (use `minSdk`) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lint { disable 'InvalidPackage' } }Suggested fix — backward-compatible conditional migration
Keeps AGP 7/8 working while letting AGP 9 users drop both compat flags.
compileSdk/minSdk(without theVersionsuffix) work from AGP 7+, so the DSL change is safe. Thekotlin-androidplugin is only applied when AGP isn't providing Kotlin itself.Changes vs. current:
compileSdkVersion 34→compileSdk 34minSdkVersion 16→minSdk 21(minSdk 16 is below Flutter's current floor anyway — feel free to keep 16 if wider support is desired)apply plugin: 'kotlin-android'guarded by theandroid.builtInKotlinpropertykotlin_versionbumped1.7.10→1.9.0(AGP 9 requires Kotlin 1.9+); drop the explicitkotlin-stdlib-jdk7dep since AGP-provided Kotlin brings its own stdlibHappy to open a PR if helpful.