【发布时间】:2016-11-28 07:38:03
【问题描述】:
我正在尝试开发一个应用程序,其中一项活动从谷歌工作表中提取数据。我正在关注
中的快速入门指南但是,在第 4 步中,我不想用他们的建议替换我的所有 gradle 设置,因为我已经在使用更高版本的 SDK 进行开发,所以我只是从他们的依赖项中添加必要的编译行,所以我的 gradle.app 看起来像这样
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.erik.icaregg"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.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.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.android.support:support-v4:25.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-auth:9.8.0'
compile 'pub.devrel:easypermissions:0.1.5'
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-sheets:v4-rev38-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
testCompile 'junit:junit:4.12'
}
当我尝试使用 gradle 运行应用程序或同步项目时,构建总是以错误告终,并且消息是
Error:14:21:26.378 [ERROR] [org.gradle.api.Task] Conflict with dependency 'com.google.code.findbugs:jsr305'. Resolved versions for app (1.3.9) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
14:21:26.396 [ERROR] [org.gradle.BuildExceptionReporter]
14:21:26.396 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
14:21:26.397 [ERROR] [org.gradle.BuildExceptionReporter]
14:21:26.397 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
14:21:26.397 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':app:prepareDebugAndroidTestDependencies'.
14:21:26.397 [ERROR] [org.gradle.BuildExceptionReporter] > Dependency Error. See console for details.
14:21:26.398 [ERROR] [org.gradle.BuildExceptionReporter]
14:21:26.398 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
14:21:26.399 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:prepareDebugAndroidTestDependencies'.
该错误未显示在工作区本身上,因此我真的很困惑错误所在的位置。谁能帮我解决这个问题?
非常感谢!
【问题讨论】:
标签: gradle sdk google-api android-gradle-plugin google-spreadsheet-api