如何更新 com.google android.gms:play-services-auth:16.0.1?

How to update com.google android.gms:play-services-auth:16.0.1?

我正在尝试 运行 android-studio 中的代码,但我收到以下警告 "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. " 我该如何解决这个问题?

我知道问题出在这一行: 实施 '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'**   
   }        

所以我在这里有冲突:实现 'com.android.support:support-media-compat:28.0.0' 和这里:实现 'com.google.android.gms:play-services-auth:16.0.1'
但是 play services-auth 已经更新了,但是程序仍然说它的版本是 26.1.0.

设置 - Google Play Services,如下所示可以看到最新版本。 Google Play Services

您需要将 Google 登录库更新到最新版本。

就我而言,我需要将我的 v7 AppCompat 更新到 v28。这样做之后,你所说的问题浮出水面。将 com.google.android.gms:play-services-auth:16.0.1 更新到最新版本会导致清单冲突,因为最新版本使用的是 Androidx。您要么将项目迁移到 Androidx 以支持 play-services-auth 的最新版本,要么在依赖项中进行排除。我还不想迁移到 Androidx,所以后者适合我。我在 gradle 文件中添加了以下内容:

implementation ('com.google.android.gms:play-services-auth:16.0.1'){
    exclude group: 'com.android.support', module:'support-v4'
}