0

I didn't find proper solution to google-service-plugin version conflict

Error:

Error:org.gradle.api.GradleException: 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 10.0.1.

Root level build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:2.3.1'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}


dependencies {
}

app level build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.sha.agecalculator"
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 11
        versionName "2.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.google.gms:google-services:3.0.0'
    compile 'com.google.firebase:firebase-ads:10.0.1'
    compile 'com.google.android.gms:play-services-ads:10.2.1'
    compile 'com.google.android.gms:play-services-analytics:10.2.1'

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'


    compile 'joda-time:joda-time:2.3'
    testCompile 'junit:junit:4.12'
}


apply plugin: 'com.google.gms.google-services'
Shareque
  • 361
  • 4
  • 23

1 Answers1

2

Wrong

 compile 'com.google.gms:google-services:3.0.0' //remove this line from dependencies 

Do

compile 'com.google.android.gms:play-services:10.2.1' 
compile 'com.google.firebase:firebase-ads:10.2.1'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
  • 1
    All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.2.0, 24.0.0. Examples include com.android.support:animated-vector-drawable:25.2.0 and com.android.support:mediarouter-v7:24.0.0 less... (Ctrl+F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.) – Shareque Apr 27 '17 at 08:38
  • for this warning you shoild use `buildToolsVersion "25.0.3"` – IntelliJ Amiya Apr 27 '17 at 08:40
  • http://stackoverflow.com/questions/42374151/all-com-android-support-libraries-must-use-the-exact-same-version-specification – IntelliJ Amiya Apr 27 '17 at 08:44
  • 1
    yes its due to SDK bundled version of Google play services, thanks – Shareque Apr 27 '17 at 09:16