0

After installing react-native-fcm , the build does not succeed. I am not quite sure what to change and what version do I use for google services.

My project grandle file looks as below:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
  repositories {
    jcenter()
    google()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.1.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
    mavenLocal()
    jcenter()
    maven {
      // Point to local maven repository
      url "$rootDir/../.expo-source/android/maven"
    }
    maven { url "https://jitpack.io" }
    maven { url "https://maven.google.com" }
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

and my project/app/grandle looks like:

    apply plugin: 'com.android.application'

android {
  compileSdkVersion 26
  buildToolsVersion '26.0.2'

  defaultConfig {
    applicationId "fi.rogerstudio.possis"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 2
    versionName "1.0.2"
    multiDexEnabled true
    ndk {
      abiFilters 'armeabi-v7a', 'x86'
    }
    manifestPlaceholders = [
      'appAuthRedirectScheme': 'fi.rogerstudio.possis'
    ]
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
  dexOptions {
    javaMaxHeapSize "8g"
  }
  lintOptions {
    abortOnError false
  }
}

task exponentPrebuildStep(type: Exec) {
  workingDir '../../'

  if (System.getProperty('os.name').toLowerCase().contains('windows')) {
    commandLine 'cmd', '/c', '.\\.expo-source\\android\\detach-scripts\\prepare-detached-build.bat'
  } else {
    commandLine './.expo-source/android/detach-scripts/prepare-detached-build.sh'
  }
}
preBuild.dependsOn exponentPrebuildStep

repositories{
  flatDir{
    dirs "../../node_modules/react-native-background-geolocation/android/libs"
  }
  mavenLocal()
  maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    compile(project(':react-native-firebase')) {
        transitive = false
    }
    compile project(':react-native-vector-icons')
  compile fileTree(dir: 'libs', include: ['*.jar'])
  testCompile 'junit:junit:4.12'
  compile 'com.android.support:multidex:1.0.2'

  compile 'com.google.android.gms:play-services:11.6.2'
  compile 'com.google.android.gms:play-services-location:11.6.2'
  compile 'com.google.android.gms:play-services-places:11.6.2'
  compile 'com.google.android.gms:play-services-maps:11.6.2'
  compile 'com.google.android.gms:play-services-ads:11.6.2'

  compile('host.exp.exponent:expoview:22.0.0@aar') {
    exclude group: 'com.facebook.android', module: 'facebook-android-sdk'
    exclude group: 'com.facebook.android', module: 'audience-network-sdk'
    exclude group: 'io.nlopez.smartlocation', module: 'library'
    transitive = true
  }

  compile ('com.facebook.android:facebook-android-sdk:4.+')
  compile('com.facebook.android:audience-network-sdk:4.+') {
    exclude module: 'play-services-ads'
  }
  compile('io.nlopez.smartlocation:library:3.2.11') {
    transitive = false
  }
  compile(project(':react-native-background-geolocation')) {
    exclude group: 'com.google.android.gms', module: 'play-services-location'
  }
  compile(name: 'tslocationmanager', ext: 'aar') {
    exclude group: 'com.google.android.gms'
  }
  compile "com.google.firebase:firebase-messaging:11.6.2"


}

apply plugin: 'com.google.gms.google-services'

The error I am getting is:

Error:Execution failed for task 
app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.6.2.

I cannot find any way of how do I solve this issue...

Mizlul
  • 1
  • 7
  • 41
  • 100
  • Going to the link provided in the error shows google-services version 3.1.2...You are referencing 3.1.1. The error is a version conflict. I would start there. Perhaps it's something else, but that would be a good starting point. – Aaron Jan 23 '18 at 16:41
  • updated version to 3.1.2 nothing happened – Mizlul Jan 23 '18 at 17:17

1 Answers1

2

This is the error:

Error:Execution failed for task app:processDebugGoogleServices'. Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.6.2.

you need to change this:

   classpath 'com.google.gms:google-services:3.1.1'

to

    classpath 'com.google.gms:google-services:3.1.2'

or update all the firebase versions to 11.8.0

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134