buildscript { repositories { google() jcenter() maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' classpath 'io.fabric.tools:gradle:1.25.4' } } apply plugin: 'com.android.library' def DEFAULT_COMPILE_SDK_VERSION = 27 def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3" def DEFAULT_TARGET_SDK_VERSION = 26 def DEFAULT_SUPPORT_LIB_VERSION = "27.0.2" android { compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION defaultConfig { minSdkVersion 16 targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION versionCode 1 versionName "1.0" multiDexEnabled true } buildTypes { release { minifyEnabled false } } productFlavors { } lintOptions { disable 'GradleCompatible' } } 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) { } } } repositories { google() jcenter() maven { url "$rootDir/../node_modules/react-native/android" name 'React Native (local)' } } def supportVersion = rootProject.hasProperty('supportLibVersion') ? rootProject.supportLibVersion : DEFAULT_SUPPORT_LIB_VERSION dependencies { // compile fileTree(include: ['*.jar'], dir: 'libs') api "com.facebook.react:react-native:+" // From node_modules api "com.android.support:support-v4:$supportVersion" // Firebase SDKs compileOnly('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') { transitive = true } compileOnly "com.google.android.gms:play-services-base:15.0.1" compileOnly "com.google.firebase:firebase-ads:15.0.1" compileOnly "com.google.firebase:firebase-auth:16.0.2" compileOnly "com.google.firebase:firebase-config:16.0.0" compileOnly "com.google.firebase:firebase-core:16.0.1" compileOnly "com.google.firebase:firebase-crash:16.0.1" compileOnly "com.google.firebase:firebase-database:16.0.1" compileOnly "com.google.firebase:firebase-firestore:17.0.2" compileOnly "com.google.firebase:firebase-functions:16.0.1" compileOnly "com.google.firebase:firebase-invites:16.0.1" compileOnly "com.google.firebase:firebase-storage:16.0.1" compileOnly "com.google.firebase:firebase-messaging:17.1.0" compileOnly "com.google.firebase:firebase-perf:16.0.0" compileOnly 'me.leolin:ShortcutBadger:1.1.21@aar' }