我可以知道我需要使用gradle编译的依赖版本

时间:2016-04-23 20:32:35

标签: android gradle android-gradle

我有下一个gradle文件:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
        classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
        classpath 'com.google.gms:google-services:2.0.0-alpha3'


    }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    compile fileTree(dir: 'libs', include: ['*.jar'])

    testCompile 'junit:junit:4.12'
    compile 'org.apache.httpcomponents:httpcore:4.4.1'
    compile 'org.apache.httpcomponents:httpclient:4.5'
    compile 'org.apache.httpcomponents:httpcore:4.4.1'
    compile 'org.apache.httpcomponents:httpclient:4.5'
    compile 'com.android.support:design:23.2.1'
    compile 'com.loopj.android:android-async-http:1.4.4'

    compile 'com.google.android.gms:play-services-base:8.4.0'
    compile 'com.google.android.gms:play-services-location:7.3.0'

    compile 'com.google.gms:google-services:2.1.0-rc1'

}

我在以compile 'com.google.android.gms

开头的行中出现错误

错误是:

  

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

     
    

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

  

我如何知道此特定组件的可用版本?

1 个答案:

答案 0 :(得分:0)

您应该保持com.google.android.gms库的版本相同。如果您打算使用v.8.4.0作为services.base,那么您应该始终保持其他的相同。因此,您还应将services-location设置为相同的版本:

compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'

有关更多版本信息,请参阅Google Play Services

此外,这是一个类似的问题,也有助于一般的Gradle设置:Version conflict updating to 8.4.0