Proguard: IllegalArgumentException: значение не является ссылочным значением - PullRequest
2 голосов
/ 25 мая 2011

Я получаю сообщение об ошибке при попытке сделать Proguard-версию моего приложения для Android. И я не могу ее погуглить.

Ошибка:

Unexpected error while performing partial evaluation:
   Class       = [com/skyhookwireless/_sdkkc]
   Method      = [<clinit>()V]
   Exception   = [java.lang.IllegalArgumentException] (Stacks have different current   sizes [4] and [1])
 Unexpected error while shrinking instructions after partial evaluation:
   Class       = [com/skyhookwireless/_sdkkc]
   Method      = [<clinit>()V]
   Exception   = [java.lang.IllegalArgumentException] (Stacks have different current sizes [4] and [1])
 Not optimizing this method
 Unexpected error while evaluating instruction:
   Class       = [com/skyhookwireless/_sdklb]
   Method      = [<clinit>()V]
   Instruction = [112] ret v0
   Exception   = [java.lang.NullPointerException] (null)
 Unexpected error while performing partial evaluation:
   Class       = [com/skyhookwireless/_sdklb]
   Method      = [<clinit>()V]
   Exception   = [java.lang.NullPointerException] (null)
 Unexpected error while shrinking instructions after partial evaluation:
   Class       = [com/skyhookwireless/_sdklb]
   Method      = [<clinit>()V]
   Exception   = [java.lang.NullPointerException] (null)
 Not optimizing this method
 Unexpected error while performing partial evaluation:
   Class       = [com/skyhookwireless/_sdklc]
   Method      = [_sdka()Z]
   Exception   = [java.lang.ArrayIndexOutOfBoundsException] (17)
 Unexpected error while shrinking instructions after partial evaluation:
   Class       = [com/skyhookwireless/_sdklc]
   Method      = [_sdka()Z]
   Exception   = [java.lang.ArrayIndexOutOfBoundsException] (17)
 Not optimizing this method
 Unexpected error while evaluating instruction:
   Class       = [com/skyhookwireless/wps/_sdktb]
   Method      = [<clinit>()V]
   Instruction = [12] aastore
   Exception   = [java.lang.IllegalArgumentException] (Value is not a reference value     [proguard.evaluation.value.UnknownIntegerValue])
 Unexpected error while performing partial evaluation:
   Class       = [com/skyhookwireless/wps/_sdktb]
   Method      = [<clinit>()V]
   Exception   = [java.lang.IllegalArgumentException] (Value is not a reference value [proguard.evaluation.value.UnknownIntegerValue])
 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.Stack.apop(Stack.java:331)
    at proguard.evaluation.Processor.visitSimpleInstruction(Processor.java:181)
    at proguard.classfile.instruction.SimpleInstruction.accept(SimpleInstruction.java:218)
    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.evaluateSubroutine(PartialEvaluator.java:907)
    at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:849)
    at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:560)
    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)

Я импортирую wpsapi.jar в свой проект в качестве внешнего jar-файла в [Project] / libs /

Вот proguard.cfg

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-dontnote
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

1 Ответ

1 голос
/ 25 мая 2011

Я не знаю точную причину этой проблемы, но я столкнулся с некоторыми странными проблемами при использовании Proguard. Я переключился на последнюю версию Proguard, и это решило все мои проблемы. Чтобы изменить версию Proguard, вам необходимо заменить папку / tools / proguard на более новую версию Proguard.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...