Skip to content

[firebase_analytics, firebase_performance]: AGP 9 incompatibility — kotlin-android plugin must be removed #17987

@dbebawy

Description

@dbebawy

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

  • Analytics
  • Performance

Which platforms are affected?

  • Android

Description

The firebase_analytics and firebase_performance plugins apply the kotlin-android plugin in their android/build.gradle files. Starting with AGP 9.0.0, built-in Kotlin is the default and applying the kotlin-android plugin causes a build failure:

Failed to apply plugin 'kotlin-android'.
> ⛔ Failed to apply plugin 'org.jetbrains.kotlin.android'
  The 'org.jetbrains.kotlin.android' plugin is no longer required for Kotlin support since AGP 9.0.

Projects that want to use AGP 9's built-in Kotlin (per the Flutter migration guide) are blocked because these plugins still reference kotlin-android.

The current workaround is to set android.builtInKotlin=false in gradle.properties and re-add the kotlin-android plugin to the app's build.gradle, but this is a temporary escape hatch that will be removed before AGP 10.0.

Reproducing the issue

  1. Create or migrate a Flutter project to AGP 9.0.0 following https://docs.flutter.dev/release/breaking-changes/migrate-to-agp-9
  2. Add firebase_analytics or firebase_performance as a dependency
  3. Run flutter build apk --debug
  4. Build fails with the error above

Firebase Core version

3.14.0

Flutter doctor

Flutter (Channel stable, 3.38.9)
Dart version 3.10.8
Android SDK version 36.0.0

Flutter dependencies

firebase_analytics: 12.1.1
firebase_performance: ^0.11.1+4

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions