【问题标题】:I didn't find proper solution google-service-plugin version conflict我没有找到合适的解决方案 google-service-plugin version conflict
【发布时间】:2017-04-27 08:24:29
【问题描述】:

我没有找到 google-service-plugin 版本冲突的合适解决方案

错误:

Error:org.gradle.api.GradleException: 请修复版本冲突 通过更新 google-services 插件的版本 (有关最新版本的信息可在 https://bintray.com/android/android-tools/com.google.gms.google-services/) 或将 com.google.android.gms 的版本更新为 10.0.1。

根级 build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:2.3.1'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}


dependencies {
}

应用级 build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.sha.agecalculator"
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 11
        versionName "2.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    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'
    })

    compile 'com.google.gms:google-services:3.0.0'
    compile 'com.google.firebase:firebase-ads:10.0.1'
    compile 'com.google.android.gms:play-services-ads:10.2.1'
    compile 'com.google.android.gms:play-services-analytics:10.2.1'

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'


    compile 'joda-time:joda-time:2.3'
    testCompile 'junit:junit:4.12'
}


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

【问题讨论】:

    标签: android android-studio android-gradle-plugin


    【解决方案1】:

    错误

     compile 'com.google.gms:google-services:3.0.0' //remove this line from dependencies 
    

    compile 'com.google.android.gms:play-services:10.2.1' 
    compile 'com.google.firebase:firebase-ads:10.2.1'
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.android.support:support-v4:25.2.0'
    

    【讨论】:

    • 所有 com.android.support 库必须使用完全相同的版本规范(混合版本会导致运行时崩溃)。找到版本 25.2.0、24.0.0。示例包括 com.android.support:animated-vector-drawable:25.2.0 和 com.android.support:mediarouter-v7:24.0.0 less... (Ctrl+F1) 有一些库或工具的组合和不兼容或可能导致错误的库。一种这样的不兼容性是使用不是最新版本的 Android 支持库版本(或者特别是低于您的 targetSdkVersion 的版本)进行编译。
    • 对于这个警告你应该使用buildToolsVersion "25.0.3"
    • 是的,由于 SDK 捆绑版本的 Google Play 服务,谢谢
    猜你喜欢
    • 1970-01-01
    • 2018-09-22
    • 1970-01-01
    • 1970-01-01
    • 2012-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-17
    相关资源
    最近更新 更多