gradle编译出错:Execution failed for task ':app:compileTestDebugJava'.

简介: STOP MAINTENANCE(本文已过时)!(2017-05-25)今天更新了android studio,从0.5.3升级到0.6.1版本,结果在IDE中编译时没有问题,但是在命令行时编译就会出现以下错误::app:compileTestDebugJava FAILEDFAILURE: Build failed with an exception.

STOP MAINTENANCE(本文已过时)!(2017-05-25)


今天更新了android studio,从0.5.3升级到0.6.1版本,结果在IDE中编译时没有问题,但是在命令行时编译就会出现以下错误:

:app:compileTestDebugJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileTestDebugJava'.
> No signature of method: com.android.build.gradle.AppPlugin.getRuntimeJarList() is applicable for argument types: () values: []

我随着更新gradle到1.12,问题同样存在。

貌似是gradle更新之后,里面的单元测试插件未更新。各种谷歌,找到了这个地址:https://github.com/robolectric/robolectric-gradle-plugin。于是换用原来的插件为这一个,修改如下(参照该项目的README):将以下内容:

    dependencies {
        classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT'
    }
修改为:
    dependencies {
        classpath 'org.robolectric:robolectric-gradle-plugin:0.11.+'
    }

同时把apply plugin: 'android-test' 修改为apply plugin: 'robolectric'


再运行Gradle clean build,成功。

目录
相关文章
|
6月前
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
40 1
|
1月前
|
Android开发
Android基于gradle task检查各个module之间资源文件冲突情况
Android基于gradle task检查各个module之间资源文件冲突情况
Android基于gradle task检查各个module之间资源文件冲突情况
|
1月前
|
Android开发
Android gradle task任务检查各个module之间资源文件冲突.md
Android gradle task任务检查各个module之间资源文件冲突.md
Android gradle task任务检查各个module之间资源文件冲突.md
|
6月前
|
Perl
pod spec lint编译时报The 'Pods-App' target has transitive dependencies that include static binaries错误问题
pod spec lint编译时报The 'Pods-App' target has transitive dependencies that include static binaries错误问题
55 1
|
6月前
|
移动开发 jenkins 持续交付
jenkins编译H5做的android端编译卫士app记录
jenkins编译H5做的android端编译卫士app记录
50 0
|
6月前
|
缓存 Java 开发工具
Error:Execution failed for task ‘:app:preDebugAndroidTestBuild’. Conflict with dependency ‘com.andr
Error:Execution failed for task ‘:app:preDebugAndroidTestBuild’. Conflict with dependency ‘com.andr
33 1
|
6月前
|
Java 数据库 索引
GreenDao,clearIdentityScope报错Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Com
GreenDao,clearIdentityScope报错Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Com
49 1
|
6月前
Error:Execution failed for task ':app:javaPreCompileDebug'. > Annotation processors must be explicit
Error:Execution failed for task ':app:javaPreCompileDebug'. > Annotation processors must be explicit
93 0
|
1月前
|
JSON 小程序 JavaScript
uni-app开发微信小程序的报错[渲染层错误]排查及解决
uni-app开发微信小程序的报错[渲染层错误]排查及解决
549 7
|
1月前
|
小程序 JavaScript 前端开发
uni-app开发微信小程序:四大解决方案,轻松应对主包与vendor.js过大打包难题
uni-app开发微信小程序:四大解决方案,轻松应对主包与vendor.js过大打包难题
662 1