0

I am getting an error as seen below image Error Conflict Image .

I have tried many links and checked out stuffs on stackoverflow and managed to resolved most part but not in entirely .Is there a easier way to resolve this version mixing part .

Below is my gradle file

    /**********My Gradle ************************/
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}



android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "com.example.company"
        minSdkVersion 15
        versionCode 8  //Update on store 25th may 18
        versionName "2.1"

        targetSdkVersion 26
        multiDexEnabled true

    }



    dexOptions {
        javaMaxHeapSize "4g"
    }

    /*buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }*/
    buildTypes {
        release {
            debuggable false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'

}

dependencies {
    implementation files('libs/jxl-2.6.10.jar')
    /*implementation 'com.android.support:appcompat-v7:23.1.1'*/

    implementation files('libs/ksoap2-android-assembly-3.4.0-jar-with-dependencies.jar')



    implementation 'com.android.support:design:24.2.1'
    implementation 'com.android.support:appcompat-v7:26.0.0'
    implementation 'com.android.support:cardview-v7:26.0.0'
    implementation 'com.google.android.gms:play-services-basement:10.2.1'
    implementation 'com.google.android.gms:play-services:10.2.1'
    implementation 'com.android.support:support-v4:26.0.0'
    implementation 'com.github.bumptech.glide:glide:3.6.0'
    implementation 'com.android.support:multidex:1.0.0'
    implementation 'com.google.android.gms:play-services-location:9.6.1'
    implementation 'com.google.android.gms:play-services-maps:9.6.1'
    implementation 'com.google.android.gms:play-services:9.6.1'
    implementation 'com.google.android.gms:play-services-identity:9.6.1'
    implementation 'com.google.android.gms:play-services-plus:9.6.1'
    implementation 'com.github.boxme:squarecamera:1.1.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
//    implementation 'com.google.firebase:firebase-messaging:10.2.1'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    implementation 'id.zelory:compressor:2.1.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'com.android.support:multidex:1.0.0'
    /*implementation 'net.hockeyapp.android:HockeySDK:5.0.1'*/
    implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true;
    }
}

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

Below is my Error Log :

 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.2.1.
    at com.google.gms.googleservices.GoogleServicesTask.checkVersionConflict(GoogleServicesTask.java:161)
    at com.google.gms.googleservices.GoogleServicesTask.action(GoogleServicesTask.java:79)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at 

I have gone through below post and manage to resolve some error but not entirely Mixing dependencies versions

.

Please check out .

Yatin
  • 2,969
  • 9
  • 34
  • 68

4 Answers4

0

All Google dependencies should have the same version. Add the following to your App build.gradle:

configurations.all {

resolutionStrategy.eachDependency { DependencyResolveDetails details ->
    if (details.getRequested().getGroup() == 'com.google.android.gms') {
        // If different projects require different versions of
        // Google Play Services it causes a crash on run.
        // Fix by overriding version for all projects.
        details.useVersion("15.0.1")
    }
  }
}
Yogesh Telang
  • 74
  • 1
  • 6
0

This is a working version of your gradle dependencies:

// All com.android.support versions the same
implementation 'com.android.support:appcompat-v7:26.1.0' // Don't use variable versions '+'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'

// All com.google.android.gms versions the same
implementation 'com.google.android.gms:play-services-basement:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-identity:15.0.1'
implementation 'com.google.android.gms:play-services-plus:15.0.1'

implementation 'com.google.android.gms:play-services:12.0.1' // Don't implement repos multiple times
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.android.support:multidex:1.0.0' // Don't implement repos multiple times
implementation 'com.android.support.constraint:constraint-layout:1.1.0' // Don't use alpha versions

implementation 'com.github.bumptech.glide:glide:3.6.0'
implementation 'com.squareup.picasso:picasso:2.5.2'

implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
/*implementation 'net.hockeyapp.android:HockeySDK:5.0.1'*/

implementation 'com.github.boxme:squarecamera:1.1.0'
implementation 'id.zelory:compressor:2.1.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
    transitive = true
}

Few tips:

  • Don't use alpha or beta version unless you know what your doing
  • Don't use variable version names (26.+), use constant version names (26.0.0)
  • Use the latest version
  • Group same version dependencies (com.android.support)
Anthony Cannon
  • 1,245
  • 9
  • 20
0

To solve this error , you need to use same gradle version for all google play services

Its good to use the latest version (Go to sdk>tools - Check the Google play services >Update it)

Well for your project you should use these gradles

Google+

com.google.android.gms:play-services-plus:15.0.1

Google Account Login

com.google.android.gms:play-services-auth:15.0.1

Google Actions, `Base Client Library

com.google.android.gms:play-services-base:15.0.1`

Google Sign In

com.google.android.gms:play-services-identity:15.0.1

Google Analytics

com.google.android.gms:play-services-analytics:15.0.2

Google Awareness

com.google.android.gms:play-services-awareness:15.0.1

Google Cast

com.google.android.gms:play-services-cast:15.0.1

Google Cloud Messaging

com.google.android.gms:play-services-gcm:15.0.1

Google Drive

com.google.android.gms:play-services-drive:15.0.1

Google Fit

com.google.android.gms:play-services-fitness:15.0.1

Google Location and Activity Recognition

com.google.android.gms:play-services-location:15.0.1

Google Maps

com.google.android.gms:play-services-maps:15.0.1

Google Mobile Ads

com.google.android.gms:play-services-ads:15.0.1

Google Places

com.google.android.gms:play-services-places:15.0.1

Mobile Vision

com.google.android.gms:play-services-vision:15.0.2

Google Nearby

com.google.android.gms:play-services-nearby:15.0.1

Google Panorama Viewer

com.google.android.gms:play-services-panorama:15.0.1

Google Play Game services

com.google.android.gms:play-services-games:15.0.1

SafetyNet

com.google.android.gms:play-services-safetynet:15.0.1

Android Pay

com.google.android.gms:play-services-wallet:15.0.1

Wear OS by Google

com.google.android.gms:play-services-wearable:15.0.1

Reference https://developers.google.com/android/guides/setup

Quick learner
  • 10,632
  • 4
  • 45
  • 55
0

As you can check in your dependencies you are using different version of google play services and firebase libraries

implementation 'com.google.android.gms:play-services:10.2.1'
implementation 'com.google.android.gms:play-services-location:9.6.1'
implementation 'com.google.firebase:firebase-messaging:11.0.4'

Use the same version.

Otherwise check this official blog.

Beginning with version 15 of all Play services and Firebase libraries, version numbers adhere to the semantic versioning scheme. Each Maven dependency matching com.google.android.gms:play-services-* and com.google.firebase:firebase-* is no longer required to have the same version number in order to work correctly at build time and at run time. You will be able to upgrade each dependency independently from each other.

Update the google play gradle plugin version to latest version, currently 3.3.+.

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

and update the libraries to the latest version.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841