You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cryptography_flutter/android/build.gradle applies the Kotlin Gradle Plugin unconditionally:
// line 13
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
// line 25
apply plugin: "kotlin-android"
AGP 9 ships built-in Kotlin (it supplies the Kotlin toolchain itself) and no longer permits a module to apply KGP. With android.builtInKotlin=true, the build hard-fails:
Failed to apply plugin 'com.android.internal.library'.
> The 'org.jetbrains.kotlin.android' plugin is no longer required for Kotlin support since AGP 9.0.
Flutter also warns on every Android build and states that future Flutter versions will fail to build if any plugin applies KGP:
WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): ... cryptography_flutter ...
Future versions of Flutter will fail to build if your app uses plugins that apply KGP.
Because the flag is project-wide and all-or-nothing, a single plugin that still applies KGP prevents the whole app from migrating.
Suggested fix
Apply KGP only on AGP < 9, which keeps older toolchains working. Several plugins have already adopted this shape (e.g. no_screenshot 1.2.0, mobile_scanner 7.4.0):
def agpMajor =com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize(".")[0] asintif (agpMajor <9) {
apply plugin: "kotlin-android"
}
// `kotlin {}` is registered by KGP on AGP < 9 and by built-in Kotlin on 9+
kotlin {
compilerOptions {
jvmTarget =org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
}
}
Two related notes:
kotlinOptions { } (line 37) is the KGP-only DSL; kotlin { compilerOptions { } } works on both paths.
main.java.srcDirs += "src/main/kotlin" (line 42) should be dropped under built-in Kotlin — the Kotlin toolchain already compiles that directory, and registering it again produces "Conflicting declarations" on recent Flutter versions.
Activity
ashutosh2014 commentedon Nov 13, 2026
Opened PR with the Android Gradle migration for built-in Kotlin (removes
kotlin-android, useskotlin.compilerOptions):https://github.com/dint-dev/cryptography/pull/new/flutter-agp9-built-in-kotlin
CloudExplorer uses a local path override on pub 2.3.4 until a release includes this fix; happy to help test a prerelease.
ashutosh2014 commentedon Nov 13, 2026
Correction: PR is #232