程序类型已存在:com.google.android.gms.ads.identifier.AdvertisingIdClient$Info

Program type already present: com.google.android.gms.ads.identifier.AdvertisingIdClient$Info

每当我在 android studio 中构建我的项目时,它都会给我以下错误 程序类型已存在:com.google.android.gms.ads.identifier.AdvertisingIdClient$Info 下面是我的 build.gradle 文件 最后,具有 implementation 'com.android.support:design:27.0.0' 的行也给出了一个错误说...... 所有 com.android.support 库必须使用完全相同的版本规范

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

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.iwatchug"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        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.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:27.0.0'
    implementation 'com.google.firebase:firebase-auth:16.2.1'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services:7+'
    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'
}

repositories {
    google()
}
apply plugin: 'com.google.gms.google-services'

删除以下行:

   implementation 'com.google.android.gms:play-services:7+'

来自docs

Note: Don't use the combined play-services target. It brings in dozens of libraries, bloating your application. Instead, specify only the specific Google Play services APIs your app uses.

您需要添加特定的google播放服务库,例如:

implementation 'com.google.android.gms:play-services-vision:17.0.2'