in Android

Android Proguard Error [Fixed]

When using proguard with your Android project, you may face the following proguard error:

Proguard returned with error code 1. See console
 Unexpected error while evaluating instruction:
   Class       = [org/jsoup/parser/TreeBuilder]
   Method      = [insertInFosterParent(Lorg/jsoup/nodes/Node;)V]
   Instruction = [70] aload_2 v2
   Exception   =  (null)
 Unexpected error while performing partial evaluation:
   Class       = [org/jsoup/parser/TreeBuilder]
   Method      = [insertInFosterParent(Lorg/jsoup/nodes/Node;)V]
   Exception   =  (null)
 java.lang.NullPointerException
 	at proguard.evaluation.Variables.aload(Variables.java:264)
 	at proguard.evaluation.Processor.visitVariableInstruction(Processor.java:677)
 	at proguard.classfile.instruction.VariableInstruction.accept(VariableInstruction.java:306)
 	at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:729)
 	at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:575)
 	at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlockAndExceptionHandlers(PartialEvaluator.java:533)
 	at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute0(PartialEvaluator.java:221)
 	at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute(PartialEvaluator.java:180)
 	at proguard.optimize.evaluation.LivenessAnalyzer.visitCodeAttribute(LivenessAnalyzer.java:195)
 	at proguard.optimize.evaluation.VariableOptimizer.visitCodeAttribute(VariableOptimizer.java:102)
 	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:439)
 	at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
 	at proguard.classfile.ProgramClass.accept(ProgramClass.java:281)
 	at proguard.classfile.ClassPool.classesAccept(ClassPool.java:114)
 	at proguard.optimize.Optimizer.execute(Optimizer.java:764)
 	at proguard.ProGuard.optimize(ProGuard.java:325)
 	at proguard.ProGuard.execute(ProGuard.java:114)
 	at proguard.ProGuard.main(ProGuard.java:499)

Fortunately, this error has been fixed at the latest proguard release (4.7), but the Android SDK still uses a previous version.
So all you have to do, it to download the latest proguard version from here, unzip it and copy paste the 3 jars from the “lib” folder to your Android-SDK folder at ANDROID_SDK_HOME/tools/proguard/lib and replace the old jars.

Backing up is always a smart and proper move.

Share