How to Mitigate Slow Build Times While Using Firebase Performance Plugin

I recently added Firebase Performance Plugin to one of my projects and experienced a drastic increase in the build time of the app. The app initially used to build in under 20 seconds and with the addition of this plugin, it started taking around 5–6 minutes for a single build. This was quite annoying and I looked for what might be causing the increase in build times.

If you look closely you will find out that the following task is taking too long to build:


There is a post-compilation phase when using Firebase Performance on Android that results in slow build times.

How to Mitigate the Issue

The fix that applied only mitigates the issue by adding a parameter to build command so that this plugin can be disabled during development.

In root/buildscript/dependencies wrap the plugin classpath inside the following if condition.

if (!project.hasProperty("disable-performance-plugin")) {
classpath('') {
exclude group: '', module: 'guava-jdk5'

Excluding depends on whether it is causing conflicts with your Guava dependencies as mentioned in the getting started documentation.

Next, in app/build.gradle wrap the apply plugin code in the following condition.

if (!project.hasProperty("disable-performance-plugin")) { 
apply plugin: ''

Now, simply build using the command line with the parameter for disabling the plugin.

./gradlew your-task -Pdisable-performance-plugin

If you use Android Studio for building the project then you add the same config in Compiler settings of Studio. Set the command line options to:


Set the Command-line option

That’s it. Adding this parameter should make your life easier! 🙂

Credits to Ivan Kravchenko for the original answer on Stack Overflow.

Make sure you give this post 50 claps and follow me if you enjoyed this post and want to see more!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.