我将Anko版本0.10.8和Kotlin版本1.3.20更新为28,编译SDK。当我尝试生成签名的APK时,出现ProGuard错误。错误日志如下。
我应该为此在ProGuard中添加什么值?
[java.lang.IllegalArgumentException] Stack size becomes negative after instruction [50] pop in [org/jetbrains/anko/Logging.error(Lorg/jetbrains/anko/AnkoLogger;Lkotlin/jvm/functions/Function0;)V]
> 15:38:22.102 [ERROR] [system.err] Unexpected error while inlining
> method: 15:38:22.102 [ERROR] [system.err] Target class =
> [org/jetbrains/anko/Logging] 15:38:22.103 [ERROR] [system.err]
> Target method =
> [error(Lorg/jetbrains/anko/AnkoLogger;Lkotlin/jvm/functions/Function0;)V]
> 15:38:22.103 [ERROR] [system.err] Exception =
> [java.lang.IllegalArgumentException] (Stack size becomes negative
> after instruction [50] pop in
> [org/jetbrains/anko/Logging.error(Lorg/jetbrains/anko/AnkoLogger;Lkotlin/jvm/functions/Function0;)V])
> 15:38:22.103 [ERROR] [system.err] java.lang.IllegalArgumentException:
> Stack size becomes negative after instruction [50] pop in
> [org/jetbrains/anko/Logging.error(Lorg/jetbrains/anko/AnkoLogger;Lkotlin/jvm/functions/Function0;)V]
> 15:38:22.103 [ERROR] [system.err] at
> proguard.classfile.attribute.visitor.StackSizeComputer.evaluateInstructionBlock(StackSizeComputer.java:349)
> 15:38:22.103 [ERROR] [system.err] at
> proguard.classfile.attribute.visitor.StackSizeComputer.visitBranchInstruction(StackSizeComputer.java:207)
> 15:38:22.103 [ERROR] [system.err] at
> proguard.classfile.instruction.BranchInstruction.accept(BranchInstruction.java:145)
> 15:38:22.103 [ERROR] [system.err] at
> proguard.classfile.attribute.visitor.StackSizeComputer.evaluateInstructionBlock(StackSizeComputer.java:366)
> 15:38:22.103 [ERROR] [system.err] at
> proguard.classfile.attribute.visitor.StackSizeComputer.visitCodeAttribute0(StackSizeComputer.java:163)
> 15:38:22.103 [ERROR] [system.err] at
> proguard.classfile.attribute.visitor.StackSizeComputer.visitCodeAttribute(StackSizeComputer.java:125)
> 15:38:22.103 [ERROR] [system.err] at
> proguard.optimize.peephole.MethodInliner.visitCodeAttribute0(MethodInliner.java:220)
> 15:38:22.103 [ERROR] [system.err] at
> proguard.optimize.peephole.MethodInliner.visitCodeAttribute(MethodInliner.java:172)
> 15:38:22.103 [ERROR] [system.err] at
> proguard.optimize.info.OptimizationCodeAttributeFilter.visitCodeAttribute(OptimizationCodeAttributeFilter.java:84)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.attribute.visitor.DebugAttributeVisitor.visitCodeAttribute(DebugAttributeVisitor.java:302)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:141)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:101)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:93)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.ProgramMethod.accept(ProgramMethod.java:93)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:588)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.ProgramClass.accept(ProgramClass.java:430)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.ClassPool.classesAccept(ClassPool.java:124)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.visitor.AllClassVisitor.visitClassPool(AllClassVisitor.java:45)
> 15:38:22.104 [ERROR] [system.err] at
> proguard.classfile.ClassPool.accept(ClassPool.java:110) 15:38:22.104
> [ERROR] [system.err] at
> proguard.optimize.Optimizer$TimedClassPoolVisitor.visitClassPool(Optimizer.java:1684)
> 15:38:22.105 [ERROR] [system.err] at
> proguard.classfile.ClassPool.accept(ClassPool.java:110) 15:38:22.105
> [ERROR] [system.err] at
> proguard.optimize.Optimizer.execute(Optimizer.java:1194) 15:38:22.105
> [ERROR] [system.err] at
> proguard.ProGuard.optimize(ProGuard.java:413) 15:38:22.105 [ERROR]
> [system.err] at proguard.ProGuard.execute(ProGuard.java:154)
> 15:38:22.105 [ERROR] [system.err] at
> com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:66)
> 15:38:22.105 [ERROR] [system.err] at
> com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:274)
> 15:38:22.105 [ERROR] [system.err] at
> com.android.build.gradle.internal.transforms.ProGuardTransform.access$000(ProGuardTransform.java:67)
> 15:38:22.105 [ERROR] [system.err] at
> com.android.build.gradle.internal.transforms.ProGuardTransform$1.run(ProGuardTransform.java:178)
> 15:38:22.105 [ERROR] [system.err] at
> com.android.builder.tasks.Job.runTask(Job.java:47) 15:38:22.105
> [ERROR] [system.err] at
> com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
> 15:38:22.105 [ERROR] [system.err] at
> com.android.builder.tasks.WorkQueue.run(WorkQueue.java:282)
> 15:38:22.106 [ERROR] [system.err] at
> java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:0)
我现在可以通过评论ProGuard的以下几行来生成Signed APK。 通过试用和试用得到了。
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static *** d(...);
public static *** w(...);
public static *** e(...);
public static *** v(...);
public static *** i(...);
public static *** wtf(...);
}