Swisyn
12/6/2016 - 11:56 AM

How to manage the firebase libraries in a multi-module projects

How to manage the firebase libraries in a multi-module projects

Centralize the firebase libraries dependencies in gradle

ext {
      firebaseVersion = '9.0.0';

      firebaseDependencies = [
              core :         "com.google.firebase:firebase-core:${firebaseVersion}",
              database :     "com.google.firebase:firebase-database:${firebaseVersion}",
              storage :      "com.google.firebase:firebase-storage:${firebaseVersion}",
              crash :        "com.google.firebase:firebase-crash:${firebaseVersion}",
              auth :         "com.google.firebase:firebase-auth:${firebaseVersion}",
              messaging :    "com.google.firebase:firebase-messaging:${firebaseVersion}",
              remoteConfig : "com.google.firebase:firebase-config:${firebaseVersion}",
              invites :      "com.google.firebase:firebase-invites:${firebaseVersion}",
              adMod :        "com.google.firebase:firebase-ads:${firebaseVersion}",
              appIndexing :  "com.google.android.gms:play-services-appindexing:${firebaseVersion}"
      ];
}

In the module1/build.gradle:

// Module build file

dependencies {
    //......
    compile firebaseDependencies.core
    compile firebaseDependencies.crash
}

Check also the support libraries code.