7a58483ba2
The project pinned Gradle 8.12 / AGP 8.9.1 / Kotlin 2.1.0, all three below the
hard error floors that Flutter 3.47.1 enforces in DependencyVersionChecker.kt
(8.14.0 / 8.11.1 / 2.2.20). Nothing here had rotted; the SDK moved.
Targets Flutter's own template defaults rather than the lowest combo that
clears the floors, because Flutter promotes its warn floor to the error floor
in the very next release -- clearing only the hard floor buys one release of
runway. `flutter-android-preflight` on the host re-derives all of this from
the installed SDK.
Also:
- kotlinOptions{} -> kotlin{compilerOptions{}}: the old DSL is a script
COMPILATION error under Kotlin >= 2.3, not a warning.
- Java/jvmTarget 11 -> 17, matching what the AndroidX artifacts now require.
- Drop android.enableJetifier (obsolete, removed outright in AGP 9); the
Flutter migrator adds builtInKotlin/newDsl=false in its place. Keep them:
builtInKotlin=true makes AGP 9.1.0 supply Kotlin 2.2.10, which is BELOW
Flutter's own 2.2.20 floor, so Flutter rejects its own recommendation.
- Force plugin subprojects to compileSdk 36 / minSdk 24. bg_launcher 0.1.0 is
abandoned at compileSdk 31 and the AndroidX artifacts it resolves to refuse
it. The override must be registered before evaluationDependsOn(":app"),
which evaluates subprojects eagerly. Dropping bg_launcher is the real fix.
Verified: flutter build apk --debug and --release, as both mikkeli and hermes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dKAqFo9Uj3mPZWvDzj3G8
54 lines
1.9 KiB
Kotlin
54 lines
1.9 KiB
Kotlin
allprojects {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
}
|
|
|
|
val newBuildDir: Directory =
|
|
rootProject.layout.buildDirectory
|
|
.dir("../../build")
|
|
.get()
|
|
rootProject.layout.buildDirectory.value(newBuildDir)
|
|
|
|
subprojects {
|
|
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
|
|
project.layout.buildDirectory.value(newSubprojectBuildDir)
|
|
}
|
|
// Force plugin subprojects onto a modern compileSdk/minSdk.
|
|
// Several pinned pub plugins are stuck on ancient values -- bg_launcher 0.1.0 is
|
|
// compileSdk 31 / minSdk 16, flutter_overlay_window 0.5.0 is compileSdk 34 -- and the
|
|
// AndroidX artifacts they now resolve to refuse to be consumed by them.
|
|
// The fix belongs HERE, not in ~/.pub-cache: that cache is shared between users,
|
|
// unversioned, and invisible to git, so an edit there silently poisons every build on
|
|
// the machine and is wiped by the next `pub get`.
|
|
// Reflection is used because AGP's types are not on the root build script classpath.
|
|
// NOTE: must be registered BEFORE evaluationDependsOn(":app") below, which evaluates
|
|
// subprojects eagerly -- after it, afterEvaluate throws.
|
|
subprojects {
|
|
afterEvaluate {
|
|
val androidExt = extensions.findByName("android") ?: return@afterEvaluate
|
|
runCatching {
|
|
androidExt.javaClass
|
|
.getMethod("setCompileSdkVersion", Int::class.javaPrimitiveType)
|
|
.invoke(androidExt, 36)
|
|
}
|
|
runCatching {
|
|
val defaultConfig = androidExt.javaClass
|
|
.getMethod("getDefaultConfig")
|
|
.invoke(androidExt)
|
|
defaultConfig.javaClass
|
|
.getMethod("setMinSdkVersion", Int::class.javaPrimitiveType)
|
|
.invoke(defaultConfig, 24)
|
|
}
|
|
}
|
|
}
|
|
|
|
subprojects {
|
|
project.evaluationDependsOn(":app")
|
|
}
|
|
|
|
tasks.register<Delete>("clean") {
|
|
delete(rootProject.layout.buildDirectory)
|
|
}
|