Search code examples
androidfirebaseandroid-gradle-pluginbuild.gradlefirebase-performance

Firebase Performance configuration fails with v1.1.2 when using implementation or api


I'm trying to upgrade my firebase-plugins dependency version to 1.1.2 which supports the Android Gradle Plugin version 3+, but the Gradle build configuration keeps failing unless I use compile which is deprecated. I'm using Play Services version 11.4.2 and and I have the firebase-perf dependency added like so which fails:

implementation "com.google.firebase:firebase-perf:$playServicesVersion"

The only way to fix it is to change the above implementation to compile. Has anyone found a solution to get around this? (Aside from downgrading to firebase-plugins version 1.1.0-alpha1?)

Here's the error message:

* What went wrong:
A problem occurred configuring project ':app'.
> To use the Firebase Performance Plugin, the Firebase Performance Monitoring SDK must be added to the app's build.gradle. Please add compile 'com.google.firebase:f
irebase-perf:VERSION_NUMBER_GREATER_THAN_OR_EQUAL_TO_11.0.4' to the app's build.gradle.

Edit: this has been fixed in firebase-plugins:1.1.3.


Solution

  • This error is because firebase-perf plugin is specifically looking for the presence of 'compile' configuration for com.google.firebase:firebase-perf SDK. If the SDK is not included in build.gradle at build time, there will be a run time crash later.

    Android Studio 3.0 replaces 'compile' with 'implementation', the plugin code should instead checking 'implementation' configuration for firebase-perf SDK.

    The workaround now is to continue using: compile "com.google.firebase:firebase-perf:$playServicesVersion"

    This will be fixed in the future firebase-plugins release.