标签:android 极光推送 jpush proguard 混淆
今天在做混淆时,极光推送报错了,错误如下:(下面错误代码从别的文章摘录而来,因为已经解决,就不再显示我自己的错误信息了,基本是一致的,除了时间。)
<span style="font-size:18px;">[2013-09-23 20:30:59 - TEST] Proguard returned with error code 1. See console [2013-09-23 20:30:59 - TEST] Note: there were 105 duplicate class definitions. [2013-09-23 20:30:59 - TEST] Unexpected error while computing stack sizes: [2013-09-23 20:30:59 - TEST] Class = [cn/jpush/android/api/InstrumentedActivity] [2013-09-23 20:30:59 - TEST] Method = [<clinit>()V] [2013-09-23 20:30:59 - TEST] Exception = [java.lang.IllegalArgumentException] (Stack size becomes negative after instruction [12] invokevirtual #57 in [cn/jpush/android/api/InstrumentedActivity.<clinit>()V]) [2013-09-23 20:30:59 - TEST] Unexpected error while editing code: [2013-09-23 20:30:59 - TEST] Class = [cn/jpush/android/api/InstrumentedActivity] [2013-09-23 20:30:59 - TEST] Method = [<clinit>()V] [2013-09-23 20:30:59 - TEST] Exception = [java.lang.IllegalArgumentException] (Stack size becomes negative after instruction [12] invokevirtual #57 in [cn/jpush/android/api/InstrumentedActivity.<clinit>()V]) [2013-09-23 20:30:59 - TEST] java.lang.IllegalArgumentException: Stack size becomes negative after instruction [12] invokevirtual #57 in [cn/jpush/android/api/InstrumentedActivity.<clinit>()V] [2013-09-23 20:30:59 - TEST] at proguard.classfile.attribute.visitor.StackSizeComputer.evaluateInstructionBlock(StackSizeComputer.java:334) [2013-09-23 20:30:59 - TEST] at proguard.classfile.attribute.visitor.StackSizeComputer.visitBranchInstruction(StackSizeComputer.java:197) [2013-09-23 20:30:59 - TEST] at proguard.classfile.instruction.BranchInstruction.accept(BranchInstruction.java:140) [2013-09-23 20:30:59 - TEST] at proguard.classfile.attribute.visitor.StackSizeComputer.evaluateInstructionBlock(StackSizeComputer.java:355) [2013-09-23 20:30:59 - TEST] at proguard.classfile.attribute.visitor.StackSizeComputer.visitCodeAttribute0(StackSizeComputer.java:153) [2013-09-23 20:30:59 - TEST] at proguard.classfile.attribute.visitor.StackSizeComputer.visitCodeAttribute(StackSizeComputer.java:110) [2013-09-23 20:30:59 - TEST] at proguard.classfile.editor.StackSizeUpdater.visitCodeAttribute(StackSizeUpdater.java:49) [2013-09-23 20:30:59 - TEST] at proguard.classfile.editor.CodeAttributeEditor.visitCodeAttribute0(CodeAttributeEditor.java:376) [2013-09-23 20:30:59 - TEST] at proguard.classfile.editor.CodeAttributeEditor.visitCodeAttribute(CodeAttributeEditor.java:311) [2013-09-23 20:30:59 - TEST] at proguard.optimize.DuplicateInitializerInvocationFixer.visitCodeAttribute(DuplicateInitializerInvocationFixer.java:92) [2013-09-23 20:30:59 - TEST] at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101) [2013-09-23 20:30:59 - TEST] at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79) [2013-09-23 20:30:59 - TEST] at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95) [2013-09-23 20:30:59 - TEST] at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:91) [2013-09-23 20:30:59 - TEST] at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71) [2013-09-23 20:30:59 - TEST] at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:504) [2013-09-23 20:30:59 - TEST] at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47) [2013-09-23 20:30:59 - TEST] at proguard.classfile.ProgramClass.accept(ProgramClass.java:346) [2013-09-23 20:30:59 - TEST] at proguard.classfile.ClassPool.classesAccept(ClassPool.java:116) [2013-09-23 20:30:59 - TEST] at proguard.optimize.Optimizer.execute(Optimizer.java:500) [2013-09-23 20:30:59 - TEST] at proguard.ProGuard.optimize(ProGuard.java:306) [2013-09-23 20:30:59 - TEST] at proguard.ProGuard.execute(ProGuard.java:115) [2013-09-23 20:30:59 - TEST] at proguard.ProGuard.main(ProGuard.java:492) </span>网上百度各种解决方案,尝试N次后仍然无效,最后同事把他的混淆文件发来全部替换,而不单纯是一个jar文件,最后完美解决。
下面简单把解决方案说一下吧:
1.在你的proguard.cfg加上代码:如果是使用新版本的ADT 将project.properties的中“# proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt”的“#”注释去掉,然后在proguard-android.txt中配置如下:
-dontwarn
cn.jpush.**
-keep class cn.jpush.** { *; }
2.使用 SDK1.3.X 及以后的版本
3.替换D:\adt-bundle-windows-x86-20130729\sdk\tools中的proguard文件夹 点我立即下载最新版混淆文件
如此,便完美解决jPush混淆报错问题了。
标签:android 极光推送 jpush proguard 混淆
原文地址:http://blog.csdn.net/u010358168/article/details/41548921