简体   繁体   中英

How to update com.google android.gms:play-services-auth:16.0.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.

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

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'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM