v11。+请通过更新google-services插件的版本来修复版本冲突

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了v11。+请通过更新google-services插件的版本来修复版本冲突相关的知识,希望对你有一定的参考价值。

我的build.gradle(模块:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "co.balraj.thawedarshan.thawedarshan"
        minSdkVersion 15
        targetSdkVersion 18
        versionCode 2
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled = true
        manifestPlaceholders = [manifestApplicationId: "${applicationId}",
        onesignal_app_id: "7a55b2de-e55d-4c10-8381-7ec71c0edddb",
        onesignal_google_project_number: "347030018851"]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    //CardView

    //Universal Image Loaader

    compile files('libs/YouTubeAndroidPlayerApi.jar')


    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:recyclerview-v7:26.+'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.android.support:cardview-v7:26.+'
    compile 'com.android.support:support-vector-drawable:26.+'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    compile 'com.android.support:support-v4:26.+'
    compile 'com.google.android.gms:play-services-ads:11.+'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.google.android.gms:play-services-identity:11.+'
    compile 'com.google.android.gms:play-services-gcm:11+'
    compile 'com.google.android.gms:play-services-analytics:11.+'
    compile 'com.google.android.gms:play-services-location:11.+'
    compile 'com.onesignal:OneSignal:2.+@aar'

    testCompile 'junit:junit:4.12'
}

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

错误

信息:Gradle任务[:app:generateDebugSources,:app:generateDebugAndroidTestSources,:app:mockableAndroidJar,:app:prepareDebugUnitTestDependencies]

错误:任务':app:processDebugGoogleServices'的执行失败。

请通过更新google-services插件的版本(https://bintray.com/android/android-tools/com.google.gms.google-services/上提供有关最新版本的信息)或将com.google.android.gms的版本更新为11. +来修复版本冲突。

答案

编译你的代码

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

并删除

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

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

它应该工作

检查您是否已将其放入gradle中:

repositories {
    jcenter()
    maven {
        maven { url "https://maven.google.com" }
    }
}

以上是关于v11。+请通过更新google-services插件的版本来修复版本冲突的主要内容,如果未能解决你的问题,请参考以下文章

通过更新 google-services 插件的版本,任务 processDebugGoogleServices 或版本冲突执行失败

Android Studio版本冲突/谷歌地图

google-services.json用于不同的productFlavors

任务执行失败':processDebugGoogleServices'

错误:文件 google-services.json 丢失。 (因为 com.google.gms:google-services 从 4.2.0 更新到 4.3.0)

更改了我的包名,更新了 google services.json 文件,计费和付款停止工作