[firebase_core, firebase_auth, firebase_analytics, firebase_app_check, firebase_crashlytics, firebase_performance]: guarded 'kotlin-android' fallback will fail on a future Flutter (KGP warning with built-in Kotlin)
Is there an existing issue for this?
- [x] I have searched the existing issues.
Related, closed: #18880 and #18919. In #18880 (https://github.com/firebase/flutterfire/issues/18880#issuecomment-6467174471) the guarded fallback is kept until FlutterFire raises its minimum Flutter SDK, "alongside Flutter's removal of Kotlin Gradle Plugin support" (flutter/flutter#184837). That Flutter issue is closed, and Flutter has since said the guarded pattern itself will stop building (below). As far as I can see, no open issue tracks the removal, so this is one.
Which plugins are affected?
Core, Auth, Analytics, App Check, Crashlytics, Performance (firebase_messaging 17.0.1 is not flagged).
Which platforms are affected?
Android
Description
With AGP 9 and android.builtInKotlin=true, Flutter 3.47.9 reports these plugins as applying the Kotlin Gradle Plugin and warns that future Flutter versions will fail the build:
WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): firebase_analytics, firebase_core, workmanager_android
Future versions of Flutter will fail to build if your app uses plugins that apply KGP.
At runtime the plugins do not apply KGP: android/build.gradle applies kotlin-android only under if (agpMajor < 9 || !builtInKotlin). The warning comes from Flutter's text check (kgpRegexGroovy in FlutterPluginUtils.kt), which matches the guarded line.
Flutter closed flutter/flutter#189770 on 2026-10-02 as intended behaviour, saying it discourages this guarded pattern and that "as soon as the regex gets patched, the workaround will fail to build" (https://github.com/flutter/flutter/issues/189770#issuecomment-5959666603). So the warning is an advance notice that these plugins will stop building on a future Flutter stable unless the fallback is removed or restructured.
Reproducing the issue
-
flutter create --platforms=android kgprepro(Flutter 3.47.9). -
flutter pub add firebase_core:5.1.0 firebase_analytics:13.0.1. -
In
android/gradle.propertiessetandroid.builtInKotlin=true(the template shipsfalse). -
In
android/settings.gradle.ktsuse AGP9.1.1and Kotlin2.4.21(Gradle wrapper9.3.1from the template). -
flutter build apk --debug: the build succeeds and prints the warning above. -
Evidence that KGP is not applied: run
./gradlew -I probe.gradle helpwithgradle.projectsEvaluated { rootProject.allprojects { p -> if (p.plugins.hasPlugin('com.android.library') || p.plugins.hasPlugin('com.android.application')) println "${p.path} kotlin-android applied: ${p.plugins.hasPlugin('org.jetbrains.kotlin.android')}" } }Output:
:firebase_analytics kotlin-android applied: falseand:firebase_core kotlin-android applied: false. The same holds in a larger app for firebase_auth 7.0.1, firebase_app_check 0.5.1, firebase_crashlytics 6.0.1 and firebase_performance 0.12.1.
Firebase Core version
5.1.0
Flutter Version
3.47.9 (stable), Dart 3.13.7
Relevant Log Output
See the warning above. There is no build failure today.
Flutter dependencies
firebase_core 5.1.0, firebase_auth 7.0.1, firebase_analytics 13.0.1, firebase_app_check 0.5.1, firebase_crashlytics 6.0.1, firebase_performance 0.12.1, firebase_messaging 17.0.1. AGP 9.1.1, Gradle 9.3.1, Kotlin 2.4.21, JDK 17/21.
Additional context and comments
Request: a plan or version for dropping (or restructuring) the kotlin-android fallback so apps on built-in Kotlin keep building once Flutter tightens the check. firebase_messaging already builds without being flagged, so it may be a model for the others.
Hi @bhavya579, thanks for the report. We're looking into this.