Error versions com.google.android.gms

1
    apply plugin: "com.android.application"

    import com.android.build.OutputFile

    apply from: "../../node_modules/react-native/react.gradle"
    project.ext.vectoricons = [
        iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf' ] // Name of the font files you want to copy
    ]

    apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

    /**
     * Set this to true to create two separate APKs instead of one:
     *   - An APK that only works on ARM devices
     *   - An APK that only works on x86 devices
     * The advantage is the size of the APK is reduced by about 4MB.
     * Upload all the APKs to the Play Store and people will download
     * the correct one based on the CPU architecture of their device.
     */
    def enableSeparateBuildPerCPUArchitecture = true

    /**
     * Run Proguard to shrink the Java bytecode in release builds.
     */
    def enableProguardInReleaseBuilds = false



     buildscript {
        repositories {
          maven { url 'https://maven.fabric.io/public' }
        }
        dependencies {
          // The Fabric Gradle plugin uses an open ended version to react
          // quickly to Android tooling updates
          classpath 'io.fabric.tools:gradle:1.+'
        }
      }
      apply plugin: 'io.fabric'
      repositories {
        maven { url 'https://maven.fabric.io/public' }
      }


    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"

        defaultConfig {
            applicationId "com.sapco.sapcoapp"
            minSdkVersion 16
            targetSdkVersion 23
            versionCode 19
            versionName "3.1.9"
            ndk {
                abiFilters "armeabi-v7a", "x86"
            }
            multiDexEnabled true
            manifestPlaceholders = [onesignal_app_id: "35aca62b-aa4f-4a86-a0e5-e3b8f11f71b1",
                                    onesignal_google_project_number: "61876614429"]
        }
    signingConfigs {
        release {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

    dependencies {
        compile project(':react-native-push-notification')
        compile ('com.google.android.gms:play-services-gcm:10.0.1') {
            force = true;
        }
        compile project(':react-native-onesignal')
        compile project(':react-native-svg')
        compile(project(':react-native-svg')) {
            exclude group: "com.android.support", module: "appcompat-v7"
        }
        compile project(':react-native-android-location-services-dialog-box')
        compile project(':react-native-maps')
        compile project(':react-native-fbsdk')
        compile project(':react-native-vector-icons')
        compile project(':react-native-fabric')
        compile fileTree(dir: "libs", include: ["*.jar"])
        compile "com.android.support:appcompat-v7:23.0.1"
        compile "com.facebook.react:react-native:+"  // From node_modules
        compile(project(':react-native-maps')){
            exclude group: 'com.google.android.gms', module: 'play-services-base'
            exclude group: 'com.google.android.gms', module: 'play-services-maps'
        }
        compile 'com.google.android.gms:play-services-base:10.0.1'
        compile 'com.google.android.gms:play-services-maps:10.0.1'

        compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
            transitive = true;
        }
        compile project(':react-native-android-location-services-dialog-box')
    }

    // Run this once to be able to run the application with BUCK
    // puts all compile dependencies into folder libs for BUCK to use
    task copyDownloadableDepsToLibs(type: Copy) {
        from configurations.compile
        into 'libs'
    }

This is the error

All com.google.android.gms libraries must use the exact same version specification”  Found versions 10.2.0 , 10.0.1

Thanks

    
asked by David Higuita 03.03.2017 в 19:02
source

2 answers

0

Change these versions

compile 'com.google.android.gms:play-services-base:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'

a

 compile 'com.google.android.gms:play-services-location:10.2.0'
 compile 'com.google.android.gms:play-services-maps:10.2.0'
    
answered by 03.03.2017 в 19:10
0

The same error message suggests:

  

All com.google.android.gms libraries must use the exact same version   specification "Found versions 10.2.0, 10.0.1

Change the version of the dependencies from 10.0.1 to 10.2.0

   compile 'com.google.android.gms:play-services-base:10.2.0'
   compile 'com.google.android.gms:play-services-maps:10.2.0'

The problem arises because some of your dependencies are calling internally version 10.2.0 and in the case of using 'com.google.android.gms: play-services-xxx', the same version will be used.

Surely it is:

compile project(':react-native-android-location-services-dialog-box')

link

    
answered by 03.03.2017 в 19:10