What's happening
Every Android build of an app using this plugin (v0.0.3) prints:
WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): ar_flutter_plugin_2
Future versions of Flutter will fail to build if your app uses plugins that apply KGP.
See Flutter's migration guide: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors
Cause
android/build.gradle declares its own Kotlin Gradle Plugin classpath and applies it the classic way:
buildscript {
ext.kotlin_version = '1.9.10'
...
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
...
apply plugin: 'kotlin-android'
Flutter's newer "Built-in Kotlin" support expects plugins to not apply their own KGP instance — Flutter's Gradle plugin supplies it. As of the current main branch this hasn't changed yet.
Impact
Currently just a warning — builds still succeed. But per the linked migration guide, a future Flutter release will refuse to build any app depending on a plugin that applies its own KGP this way, which would break every app using ar_flutter_plugin_2 on that Flutter version.
Suggested fix
Migrate android/build.gradle to the declarative plugins-block form Flutter's guide recommends (roughly):
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android' apply false
}
and let Flutter's Gradle plugin supply the actual Kotlin Gradle Plugin version, rather than declaring a separate buildscript { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:...' } block.
Happy to test a patched version against a real device if a branch/PR is put up — this plugin is a dependency of a small production app we maintain.
What's happening
Every Android build of an app using this plugin (v0.0.3) prints:
See Flutter's migration guide: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors
Cause
android/build.gradledeclares its own Kotlin Gradle Plugin classpath and applies it the classic way:Flutter's newer "Built-in Kotlin" support expects plugins to not apply their own KGP instance — Flutter's Gradle plugin supplies it. As of the current
mainbranch this hasn't changed yet.Impact
Currently just a warning — builds still succeed. But per the linked migration guide, a future Flutter release will refuse to build any app depending on a plugin that applies its own KGP this way, which would break every app using
ar_flutter_plugin_2on that Flutter version.Suggested fix
Migrate
android/build.gradleto the declarative plugins-block form Flutter's guide recommends (roughly):and let Flutter's Gradle plugin supply the actual Kotlin Gradle Plugin version, rather than declaring a separate
buildscript { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:...' }block.Happy to test a patched version against a real device if a branch/PR is put up — this plugin is a dependency of a small production app we maintain.