web-dev-qa-db-fra.com

La génération échoue avec l'application: transformClassesAndResourcesWithProguardForRelease

J'ai récemment mis à jour Android studios vers la version 2.3, construire des outils pour 25.0.2, gradle 2.3.0 et gradle distribution 3.3 et maintenant je l'obtiens lors de la construction du projet. Jamais eu ce problème avec les anciens 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
11

Un problème similaire est référencé ici . Il semble être corrigé dans proguard 5.3.3.

Essayez de mettre à niveau proguard vers 5.3.3 avec:

buildscript {
    configurations.all {
        resolutionStrategy {
            force 'net.sf.proguard:proguard-gradle:5.3.3'
        }
    }
}
11
Bertrand Martel

Eu un problème similaire,

-ignorewarnings

Au bout du proguard-rules.pro l'a corrigé.

6
Moti Bartov