javaandroidfirebaseandroid-gradle-pluginfirebase-performance

Firebase Performance Plugin causing slow build time


When using Firebase Performance in Android Studio the gradle task app:transformClassesWithFirebasePerformancePluginForDebug is taking significantly longer than any other task and is therefore dramatically slowing down my gradle build times.

Slow Build shown in Profiler


Solution

  • Firebase in our project caused 40% build time increase. To speed up debug builds we added a possibility to switch it on/off using build parameters in app/build.gradle and root build.gradle files:

    app:

    if (!project.hasProperty("disable-performance-plugin"))  {
        apply plugin: 'com.google.firebase.firebase-perf' 
    }
    

    root/buildscript/dependencies:

    if (!project.hasProperty("disable-performance-plugin")) {
        classpath('com.google.firebase:firebase-plugins:1.1.5') {
            exclude group: 'com.google.guava', module: 'guava-jdk5'
        }
    }
    

    when running from the command line use

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

    when working from Android Studio, add the flag to compiler options:

    Android Studio compiler options