2014-10-14 24 views
5

Próbuję utworzyć apk release z włączonym proguardem. Dostaję błąd poniżej. Załączam pełny stacktrace poniżej.Proguard: IllegalArgumentException - nieoczekiwany błąd podczas oceniania instrukcji

Unexpected error while evaluating instruction: 
Class  = [*] 
    Method  = [myMethod(Ljava/lang/String;Ljava/util/Map;)V] 
    Instruction = [532] aload_3 v3 
    Exception = [java.lang.IllegalArgumentException] (Value is not a reference value [proguard.evaluation.value.UnknownIntegerValue]) 
    Unexpected error while performing partial evaluation: 
    Class  = [*] 
    Method  = [myMethod(Ljava/lang/String;Ljava/util/Map;)V] 
    Exception = [java.lang.IllegalArgumentException] (Value is not a reference value [proguard.evaluation.value.UnknownIntegerValue]) 
:*:proguardRelease FAILED 

mam zawężony problemu w dół do linii kodu, które nie są wymienione w stacktrace.

RelativeLayout.LayoutParams relativeLayoutParams = new RelativeLayout.LayoutParams(
        ViewGroup.LayoutParams.MATCH_PARENT, 
        ViewGroup.LayoutParams.WRAP_CONTENT); 

Jeśli mam to skomentować, proguard kończy się bez problemu.

W tej chwili zaktualizowałem program do nowego 5.0 i nie przynosiło to efektu.

Czy jest coś, co robię źle?

Wyjątek pełny StackTrace:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':*:proguardRelease'. 
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) 
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) 
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) 
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) 
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) 
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42) 
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) 
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) 
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) 
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305) 
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79) 
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63) 
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51) 
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23) 
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88) 
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29) 
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62) 
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) 
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68) 
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) 
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62) 
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55) 
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149) 
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106) 
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86) 
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80) 
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33) 
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24) 
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36) 
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) 
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51) 
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171) 
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237) 
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210) 
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35) 
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24) 
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206) 
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) 
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) 
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) 
at org.gradle.launcher.Main.doAction(Main.java:33) 
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) 
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54) 
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35) 
at org.gradle.launcher.GradleMain.main(GradleMain.java:23) 
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33) 
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130) 
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48) 

Caused by: java.lang.IllegalArgumentException: Value is not a reference value [proguard.evaluation.value.UnknownIntegerValue] 
at proguard.evaluation.value.Value.referenceValue(Value.java:97) 
at proguard.evaluation.Variables.aload(Variables.java:263) 
at proguard.evaluation.Processor.visitVariableInstruction(Processor.java:688) 
at proguard.classfile.instruction.VariableInstruction.accept(VariableInstruction.java:306) 
at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:753) 
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:602) 
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlockAndExceptionHandlers(PartialEvaluator.java:560) 
at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute0(PartialEvaluator.java:264) 
at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute(PartialEvaluator.java:181) 
at proguard.optimize.info.ParameterUsageMarker.visitCodeAttribute(ParameterUsageMarker.java:176) 
at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101) 
at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79) 
at proguard.optimize.info.ParameterUsageMarker.visitProgramMethod(ParameterUsageMarker.java:136) 
at proguard.optimize.OptimizationInfoMemberFilter.visitProgramMethod(OptimizationInfoMemberFilter.java:81) 
at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71) 
at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:504) 
at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47) 
at proguard.classfile.ProgramClass.accept(ProgramClass.java:346) 
at proguard.classfile.ClassPool.classesAccept(ClassPool.java:124) 
at proguard.optimize.Optimizer.execute(Optimizer.java:394) 
at proguard.ProGuard.optimize(ProGuard.java:306) 
at proguard.ProGuard.execute(ProGuard.java:115) 
at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074) 
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63) 
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218) 
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211) 
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200) 
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:579) 
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:562) 
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) 
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) 
... 47 more 

Odpowiedz

13

Jest to prawdopodobnie błąd w optymalizacji typów wyliczeniowych przez ProGuard. Możesz być w stanie obejść przez wyłączenie tej optymalizacji:

-optimizations !class/unboxing/enum 

Jeśli możesz to zgłosić lub napisz do mnie szczegóły, będę na nią patrzeć.

(Jestem deweloper PROGUARD)

+0

@Eric, jestem uderzając to z PROGUARD 5.2 (chociaż ja wydobytego metodę jak sugeruje Calvin). Czy istnieje zgłoszenie błędu, które mogę śledzić? – Jayen

+0

@Eric, Czy mógłbyś zamieścić bardziej szczegółowy opis gdzie dodać '-optimizations! Class/unboxing/enum'? –

0

rozwiązanie dziwne, ale znalazłem sposób, żeby to naprawić. Dokładna sekcja kodu, która spowodowała problem z proguardem, została rozdzielona na inną metodę i w starej lokalizacji, do której wywołano tę metodę. Wydaje się, że naprawiło to problemy, chociaż nie jestem pewien, jak to rozwiązało. To po prostu wydaje się bardziej jak błąd Proguarda. Działa to dla mnie, więc jest to coś, co inni mogą spróbować, jeśli kiedykolwiek napotkają na ten problem.