错误:执行任务“:app:processDebugGoogleServices”失败。Android

6

错误:执行任务':app:processDebugGoogleServices'失败。请通过更新google-services插件的版本(有关最新版本的信息可在https://bintray.com/android/android-tools/com.google.gms.google-services/查看)或将com.google.android.gms的版本更新为9.0.2来解决版本冲突。

这是我遇到的错误。以下是我的gradle文件。我尝试了stackoverflow上的许多解决方案,但没有一个适用于我的情况。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.radioaudio.motivationalaudios"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile 'com.google.android.gms:play-services:9.0.2'
    compile 'com.google.firebase:firebase-ads:9.0.2'
    compile 'com.google.firebase:firebase-core:9.0.2'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:multidex:1.0.1'

    compile 'com.onesignal:OneSignal:2.+@aar'
    compile 'com.google.android.gms:play-services-gcm:+'
    compile 'com.google.android.gms:play-services-analytics:+'
    compile 'com.google.android.gms:play-services-location:+'
}
apply plugin: 'com.google.gms.google-services'

请检查您的项目级别 build.gradle 文件,看看是否在那里放置了 Google 服务依赖项? - PN10
1个回答

2

使用编译器进行编译

dependencies {
    compile 'com.google.android.gms:play-services:9.6.1'
}

并删除

compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-analytics:+'
compile 'com.google.android.gms:play-services-location:+'

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

它应该可以正常工作


是的,它可以工作,但我正在使用Onesignal推送通知。根据Onesignal的文档,我必须添加这些库。 - ak47
这些库是Google Play服务的子库,当您添加它们时,它们会自动添加。 - Dr. Arslan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接