Build fails with app:transformClassesAndResourcesW

2020-02-06 05:39发布

I recently updated android studios to version 2.3, build tools to 25.0.2, gradle 2.3.0 and gradle distribution 3.3 and now i am getting this while building the project. Never had this issue with older versions.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: java.lang.RuntimeException: Job failed, see logs for details
        at com.android.build.gradle.internal.transforms.ProGuardTransform.transform(ProGuardTransform.java:196)
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:185)
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:181)
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
        at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:176)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:163)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
        ... 20 more
Caused by: java.io.IOException: java.lang.NullPointerException
        at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:283)
        at com.android.build.gradle.internal.transforms.ProGuardTransform.access$000(ProGuardTransform.java:63)
        at com.android.build.gradle.internal.transforms.ProGuardTransform$1.run(ProGuardTransform.java:173)
        at com.android.builder.tasks.Job.runTask(Job.java:48)
        at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
        at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:225)
Caused by: java.lang.NullPointerException
        at proguard.optimize.info.NonEmptyStackReturnMarker.setReturnsWithNonEmptyStack(NonEmptyStackReturnMarker.java:102)
        at proguard.optimize.info.NonEmptyStackReturnMarker.markReturnWithNonEmptyStack(NonEmptyStackReturnMarker.java:95)
        at proguard.optimize.info.NonEmptyStackReturnMarker.visitSimpleInstruction(NonEmptyStackReturnMarker.java:72)
        at proguard.classfile.instruction.visitor.MultiInstructionVisitor.visitSimpleInstruction(MultiInstructionVisitor.java:88)
        at proguard.classfile.instruction.SimpleInstruction.accept(SimpleInstruction.java:218)
        at proguard.classfile.attribute.CodeAttribute.instructionsAccept(CodeAttribute.java:138)
        at proguard.classfile.attribute.CodeAttribute.instructionsAccept(CodeAttribute.java:110)
        at proguard.classfile.instruction.visitor.AllInstructionVisitor.visitCodeAttribute(AllInstructionVisitor.java:54)
        at proguard.classfile.attribute.visitor.MultiAttributeVisitor.visitCodeAttribute(MultiAttributeVisitor.java:245)
        at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
        at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:81)
        at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
        at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:92)
        at proguard.classfile.visitor.MultiMemberVisitor.visitProgramMethod(MultiMemberVisitor.java:92)
        at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:73)
        at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:516)
        at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
        at proguard.classfile.visitor.MultiClassVisitor.visitProgramClass(MultiClassVisitor.java:85)
        at proguard.classfile.ProgramClass.accept(ProgramClass.java:358)
        at proguard.classfile.ClassPool.classesAccept(ClassPool.java:124)
        at proguard.optimize.Optimizer.execute(Optimizer.java:649)
        at proguard.ProGuard.optimize(ProGuard.java:328)
        at proguard.ProGuard.execute(ProGuard.java:127)
        at com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:54)
        at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:254)
        ... 5 more


BUILD FAILED

2条回答
beautiful°
2楼-- · 2020-02-06 06:40

A similar issue is referenced here. It seems to be fixed in proguard 5.3.3.

Try upgrading proguard to 5.3.3 with :

buildscript {
    configurations.all {
        resolutionStrategy {
            force 'net.sf.proguard:proguard-gradle:5.3.3'
        }
    }
}
查看更多
▲ chillily
3楼-- · 2020-02-06 06:44

Had similar problem,

-ignorewarnings

At the end of proguard-rules.pro fixed it.

查看更多
登录 后发表回答