buildscript { ext.firebaseVersion = '12.0.0' repositories { jcenter() mavenLocal() maven { url "https://maven.google.com" } maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath 'io.fabric.tools:gradle:1.25.1' } } apply plugin: 'com.android.library' android { compileSdkVersion 27 buildToolsVersion "27.0.2" defaultConfig { minSdkVersion 16 targetSdkVersion 27 versionCode 1 versionName "1.0" multiDexEnabled true } buildTypes { release { minifyEnabled false } } productFlavors { } } allprojects { repositories { jcenter() mavenLocal() maven { url "https://maven.google.com" } } } rootProject.gradle.buildFinished { buildResult -> if (buildResult.getFailure() != null) { try { String message = buildResult.getFailure().properties.get("reportableCauses").toString() if (message.contains("com.android.dex.DexException: Multiple dex files define Lcom/google/") || message.contains("java.util.zip.ZipException: duplicate entry: com/google/android/gms/")) { logger.log(LogLevel.ERROR, "") logger.log(LogLevel.ERROR, " -----------------------------------------------------------") logger.log(LogLevel.ERROR, "| REACT NATIVE FIREBASE |") logger.log(LogLevel.ERROR, " ----------------------------------------------------------- ") logger.log(LogLevel.ERROR, "| |") logger.log(LogLevel.ERROR, "| This is a common build error when using libraries that |") logger.log(LogLevel.ERROR, "| require google play services. |") logger.log(LogLevel.ERROR, "| |") logger.log(LogLevel.ERROR, "| This error occurs because different versions of google |") logger.log(LogLevel.ERROR, "| play services or google play services modules are being |") logger.log(LogLevel.ERROR, "| required by different libraries. |") logger.log(LogLevel.ERROR, "| |") logger.log(LogLevel.ERROR, "| A temporary fix would be to set: |") logger.log(LogLevel.ERROR, "| |") logger.log(LogLevel.ERROR, "| android { multiDexEnabled true } |") logger.log(LogLevel.ERROR, "| |") logger.log(LogLevel.ERROR, "| inside your build gradle, however it is recommended for |") logger.log(LogLevel.ERROR, "| your prod build that you de-duplicate these to minimize |") logger.log(LogLevel.ERROR, "| bundle size. |") logger.log(LogLevel.ERROR, "| |") logger.log(LogLevel.ERROR, "| See http://invertase.link/dupe-dex for how to do this. |") logger.log(LogLevel.ERROR, "| |") logger.log(LogLevel.ERROR, " ----------------------------------------------------------- ") } } catch (Exception exception) { } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') //noinspection GradleDynamicVersion compile "com.facebook.react:react-native:+" // From node_modules compile "com.android.support:support-v4:27.1.0" compile 'me.leolin:ShortcutBadger:1.1.21@aar' compile "com.google.android.gms:play-services-base:$firebaseVersion" compile "com.google.firebase:firebase-core:$firebaseVersion" compile "com.google.firebase:firebase-config:$firebaseVersion" compile "com.google.firebase:firebase-auth:$firebaseVersion" compile "com.google.firebase:firebase-database:$firebaseVersion" compile "com.google.firebase:firebase-storage:$firebaseVersion" compile "com.google.firebase:firebase-messaging:$firebaseVersion" compile "com.google.firebase:firebase-crash:$firebaseVersion" compile "com.google.firebase:firebase-perf:$firebaseVersion" compile "com.google.firebase:firebase-ads:$firebaseVersion" compile "com.google.firebase:firebase-firestore:$firebaseVersion" compile "com.google.firebase:firebase-invites:$firebaseVersion" compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') { transitive = true } }