1

I am trying to run a code in android-studio but I get following warning "All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-v4:26.1. " How can I fix this?

I know that the problem is in this line: implementation 'com.google.android.gms:play-services-auth:16.0.1'

    apply plugin: 'com.android.application'

    android    {    
    compileSdkVersion  28    
    defaultConfig {  
    applicationId "com.example.irma"    
    minSdkVersion 15    
    targetSdkVersion 28    
    versionCode 1    
    versionName "1.0"    
    testInstrumentationRunner      
    "android.support.test.runner.AndroidJUnitRunner"    
    }    
    buildTypes {    
      release {    
        minifyEnabled false    
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'    
        }    
      }    
    }    

  dependencies {    
  implementation fileTree(dir: 'libs', include: ['*.jar'])     
  **implementation 'com.android.support:support-media- 
  compat:28.0.0'**           
  implementation 'com.android.support:appcompat-v7:28.0.0'    
  implementation 'com.android.support.constraint:constraint- 
  layout:1.1.3'    
  testImplementation 'junit:junit:4.12'    
  androidTestImplementation 'com.android.support.test:runner:1.0.2'    
  androidTestImplementation  'com.android.support.test.espresso:espresso-core:3.0.2'    
  }    


dependencies {    
implementation fileTree(dir: 'libs', include: ['*.jar'])    
implementation 'com.android.support:appcompat-v7:28.0.0'             
**implementation 'com.google.android.gms:play-services-auth:16.0.1'**   
   }        

So I have conflict here: implementation 'com.android.support:support-media-compat:28.0.0' and here: implementation 'com.google.android.gms:play-services-auth:16.0.1'
But play services-auth is already updated, but the program still says its on version 26.1.0.

Elio Lako
  • 1,333
  • 2
  • 16
  • 26
I. Ha
  • 13
  • 1
  • 5
  • For further guidelines, you can follow [this SO post](https://stackoverflow.com/questions/42374151/all-com-android-support-libraries-must-use-the-exact-same-version-specification). By using using the current version of android studio, you will be able to get hint on what error you are getting. And there are solutions and brief description about how's and why's of this error. – MαπμQμαπkγVπ.0 Feb 15 '19 at 09:25

2 Answers2

1

You need to update the Google Sign-In lib to the latest version.

In my case, I need to update my v7 AppCompat to v28. After doing so, the issue you stated surfaced. Updating com.google.android.gms:play-services-auth:16.0.1 to the latest version would result to Manifest conflicts because the latest version uses Androidx. You either migrate your project to Androidx to support play-services-auth's latest version or make exclusion in the dependencies. I didn't want to migrate to Androidx yet, so the latter works for me. I added the following to the gradle file:

implementation ('com.google.android.gms:play-services-auth:16.0.1'){
    exclude group: 'com.android.support', module:'support-v4'
}
zeenosaur
  • 888
  • 11
  • 16
0

Set Up - Google Play Services, as follow you can see the lastest versions. Google Play Services

Elio Lako
  • 1,333
  • 2
  • 16
  • 26