flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

Kotlin Gradle Plugin usage prevents Built-in Kotlin compatibility in Flutter

Open Tanish2709 opened this issue 5 months ago • 5 comments

Problem

Flutter reports that this plugin applies the Kotlin Gradle Plugin (KGP), which will cause build failures in future Flutter versions.

Affected plugin

firebase_storage

Flutter warning

Your app uses plugins that apply Kotlin Gradle Plugin (KGP). Future versions of Flutter will fail to build.

Environment

  • Flutter version: Flutter 3.44.1
  • Dart version: Dart 3.12.1
  • Android Gradle Plugin version:8.11.1
  • Gradle version:8.14
  • Kotlin version:2.2.20

Expected behavior

Plugin should use Built-in Kotlin support instead of applying KGP manually.

Actual behavior

Plugin applies Kotlin Gradle Plugin internally.

Impact

Build will break in future Flutter releases when KGP is removed.

Suggested fix (from Flutter docs)

Migrate plugin to Built-in Kotlin as described here: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors

##flutter build apk -v

WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): firebase_storage, share_plus Future versions of Flutter will fail to build if your app uses plugins that apply KGP.

Please check the changelogs of these plugins and upgrade to a version that supports Built-in Kotlin. If no such version exists, report the issue to the plugin. If necessary, here is a guide on filing an issue against a plugin: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-app-developers#report-incompatible-kotlin-gradle-plugin-usage-to-plugin-authors

If you are a plugin author, please migrate your plugin to Built-in Kotlin using this guide: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors

Tanish2709 avatar Jun 07 '26 06:06 Tanish2709

Hi @Tanish2709, thanks for reporting this and including the Flutter warning.

I confirmed firebase_storage had a compatibility guard that still forced kotlin-android whenever the app used AGP < 9, even if Flutter/Gradle explicitly opted into built-in Kotlin with android.builtInKotlin=true. That means the plugin could keep triggering Flutter's KGP warning during the migration period.

I've prepared a small fix so firebase_storage now respects the android.builtInKotlin flag: it only applies KGP when built-in Kotlin is disabled, while still preserving the legacy default for older setups.

Lyokone avatar Jun 08 '26 12:06 Lyokone

I got the same warning for firebase_analytics:

WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): firebase_analytics
Future versions of Flutter will fail to build if your app uses plugins that apply KGP.

I'm on Flutter 3.44.1, AGP 8.11.1.

ibluegreen avatar Jun 12 '26 13:06 ibluegreen

I’d like to work on this.

Plan:

Reproduce the warning on current Flutter Migrate the plugin Android configuration to Built-in Kotlin Verify the warning disappears Run existing tests and submit a PR

prithvisaran3 avatar Jun 25 '26 17:06 prithvisaran3

Any update for us?

WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): firebase_analytics, firebase_app_check, firebase_performance, firebase_remote_config, firebase_storage Future versions of Flutter will fail to build if your app uses plugins that apply KGP.

pMertDogan avatar Jul 14 '26 23:07 pMertDogan

I’m seeing the same warning for firebase_analytics.

Environment:

  • Flutter 3.44.8 / Dart 3.12.2
  • firebase_analytics 12.4.5
  • AGP 9.3.0 / Gradle 9.5.0
  • Kotlin 2.3.21 / JDK 17

Flutter reports:

Plugins applying Kotlin Gradle Plugin (KGP): file_picker, firebase_analytics
Future versions of Flutter will fail to build.

The build currently succeeds. My project uses Flutter’s temporary compatibility flags:

android.newDsl=false
android.builtInKotlin=false

Is this expected, and is firebase_analytics fully ready for Built-in Kotlin?

AmrTawfek avatar Jul 30 '26 07:07 AmrTawfek