2017-04-27 40 views
0

我沒有找到妥善的解決辦法,以谷歌服務的插件版本衝突我沒有找到妥善的解決辦法谷歌服務的插件版本衝突

錯誤:

Error:org.gradle.api.GradleException: Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 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' 

回答

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' 
+1

所有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的版本)編譯。 – Shareque

+0

對於此警告,您需要使用'buildToolsVersion「25.0.3」' –

+0

http: //stackoverflow.com/questions/42374151/all-com-android-support-libraries-must-use-the-exact-same-version-specification –

相關問題