任务mockableAndroidJar的执行失败

时间:2015-12-30 20:43:22

标签: android android-studio android-gradle mockito build.gradle

当我尝试构建应用程序时,我遇到了这个异常:

Execution failed for task ':app:mockableAndroidJar'.
> java.io.EOFException: Unexpected end of ZLIB input stream

这是stactrace的片段:

Caused by: org.gradle.api.UncheckedIOException: java.io.EOFException: Unexpected end of ZLIB input stream
        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:43)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:78)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:226)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:589)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:572)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 49 more
Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
        at org.objectweb.asm.ClassReader.a(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at com.android.builder.testing.MockableJarGenerator.rewriteClass(MockableJarGenerator.java:126)
        at com.android.builder.testing.MockableJarGenerator.createMockableJar(MockableJarGenerator.java:91)
        at com.android.build.gradle.internal.tasks.MockableAndroidJarTask.createMockableJar(MockableAndroidJarTask.java:51)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)

配置:com.android.tools.build:gradle:1.3.0buildToolsVersion 23.0.2gradle 2.4

无法弄清楚发生了什么错误。以前它的工作和配置并没有改变。请帮忙。

2 个答案:

答案 0 :(得分:1)

您可以尝试取消选中内部的测试工件选项:

偏好设置 - &gt;构建,执行,部署 - &gt; Gradle - &gt;实验 - &gt;启用Android项目中的所有测试工件

答案 1 :(得分:0)

我认为不同版本的实际原因: compileSdkVersion 23 buildToolsVersion“23.0.1” 与...的相同版本有关 依赖     编译'com.android.support:appcompat-v7:23.4.0'     编译'com.android.support:design:23.4.0'

没问题。