当我尝试构建应用程序时,我会遇到以下异常:
Execution failed for task ':app:mockableAndroidJar'.
> java.io.EOFException: Unexpected end of ZLIB input stream
这是stacktrace:的片段
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.0
、buildToolsVersion 23.0.2
、gradle 2.4
无法弄清楚发生了什么错误。它曾经工作过,配置很长时间都没有改变。请帮忙。
您可以尝试取消选中中的测试工件选项
首选项->构建、执行、部署->渐变->实验->启用Android项目中的所有测试工件
我认为不同版本的实际原因:compileSdk版本23buildToolsVersion"23.0.1"与的相同版本相关依赖项编译"com.android.support:appcompat-v7:23.4.0'编译com.android.support:设计:23.4.0'
可以。