1
votes

I'm using the standard generated build.xml file for ant builds. It builds with success when I type ant debug, but when I run the ant release command it fails. I guess it is related to proguard rules, however it builds with success on eclipse in release mode.

How can I configure it to work properly with proguard?

Here is the exception I got.

[proguard] Optimizing...

BUILD FAILED C:\android\sdk\tools\ant\build.xml:875: java.lang.IllegalArgumentException: Value is not a reference value [proguard.evaluation.value.Instru ctionOffsetValue] at proguard.evaluation.value.Value.referenceValue(Value.java:97) at proguard.optimize.evaluation.SimpleEnumUseSimplifier.isPoppingSimpleEnum(SimpleEnumUseSimplifier.java:530) at proguard.optimize.evaluation.SimpleEnumUseSimplifier.isPoppingSimpleEnum(SimpleEnumUseSimplifier.java:520) at proguard.optimize.evaluation.SimpleEnumUseSimplifier.visitVariableInstruction(SimpleEnumUseSimplifier.java:229) at proguard.classfile.instruction.VariableInstruction.accept(VariableInstruction.java:306) at proguard.optimize.evaluation.SimpleEnumUseSimplifier.visitCodeAttribute(SimpleEnumUseSimplifier.java:131) at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101) at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79) at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95) at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:91) 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:373) at proguard.ProGuard.optimize(ProGuard.java:306) at proguard.ProGuard.execute(ProGuard.java:115) at proguard.ant.ProGuardTask.execute(ProGuardTask.java:316) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) at com.android.ant.IfElseTask.execute(IfElseTask.java:120) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:435) at org.apache.tools.ant.Target.performTasks(Target.java:456) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) at org.apache.tools.ant.Project.executeTarget(Project.java:1364) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1248) at org.apache.tools.ant.Main.runBuild(Main.java:851) at org.apache.tools.ant.Main.startAnt(Main.java:235) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

2
Paste your proguard.txt file pleasePauland
@Pauland also note that I use it with proguard-android-optimize.txtMinas
try to use only proguard-android-optimize, to see if the problem persistsPauland

2 Answers

4
votes

This is a bug with ProGuard version 4.11.

http://sourceforge.net/p/proguard/bugs/505/

Instead of downgrading, an alternative solution can be to turn off the particular optimization causing the problem.

Include this line in your proguard file:

-optimizations !class/unboxing/enum

2
votes

I found the solution.

The issue was related to proguard version which I updated to 4.11

Reverted back to 4.7 and it started to work!