Rhino 和 Proguard (IllegalArgumentException)
Rhino and Proguard (IllegalArgumentException)
在我的 Android 项目中使用 rhino 库并尝试使用 proguard 不混淆 Rhino jar。
https://docs.oracle.com/javase/7/docs/api/javax/swing/JInternalFrame.html
JInternalFrame 不是 android 包的一部分..
proguard 设置:
# rhino (javascript)
-dontwarn org.mozilla.javascript.**
-dontwarn org.mozilla.classfile.**
-keep class org.mozilla.classfile.** { *; }
-keep class org.mozilla.javascript.* { *; }
-keep public class org.mozilla.javascript.tools.debugger.SwingGui.Dim$StackFrame { *; }
-keep class org.mozilla.javascript.tools.debugger.SwingGui.Dim$StackFrame { *; }
-keep class org.mozilla.javascript.tools.debugger.SwingGui.Dim$StackFrame { public protected *; }
-keep class org.mozilla.javascript.tools.debugger.SwingGui { *; }
-keep class org.mozilla.javascript.tools.debugger.SwingGui.* { *; }
-keep class org.mozilla.javascript.tools.debugger.SwingGui.** { *; }
-keep class org.mozilla.javascript.tools.debugger.** { *; }
-keep class org.mozilla.javascript.tools.debugger.FileWindow.* { *; }
-keep class org.mozilla.javascript.tools.debugger.** { *; }
-keep class org.mozilla.javascript.tools.** { *; }
-keep class org.mozilla.javascript.annotations.** { *; }
-keep class org.mozilla.javascript.ast.** { *; }
-keep class org.mozilla.javascript.commonjs.module.** { *; }
-keep class org.mozilla.javascript.commonjs.module.provider.** { *; }
-keep class org.mozilla.javascript.debug.** { *; }
-keep class org.mozilla.javascript.jdk13.** { *; }
-keep class org.mozilla.javascript.jdk15.** { *; }
-keep class org.mozilla.javascript.json.** { *; }
-keep class org.mozilla.javascript.optimizer.** { *; }
-keep class org.mozilla.javascript.regexp.** { *; }
-keep class org.mozilla.javascript.serialize.** { *; }
-keep class org.mozilla.javascript.typedarrays.** { *; }
-keep class org.mozilla.javascript.v8dtoa.** { *; }
-keep class org.mozilla.javascript.xml.** { *; }
-keep class org.mozilla.javascript.xmlimpl.** { *; }
-keep class org.apache.http.** { *; }
-keep class org.apache.commons.codec.** { *; }
-keep class org.apache.commons.logging.** { *; }
-keep class android.net.compatibility.** { *; }
-keep class android.net.http.** { *; }
-dontwarn org.apache.http.**
-dontwarn android.webkit.**
在 Eclipse 中导出未签名的 apk 时出现异常:
[2016-01-28 13:02:14 - BRANCH_NOW] Proguard returned with error code 1. See console
[2016-01-28 13:02:14 - BRANCH_NOW] Note: there were 4084 duplicate class definitions.
[2016-01-28 13:02:14 - BRANCH_NOW] You should check if you need to specify additional program jars.
[2016-01-28 13:02:14 - BRANCH_NOW] Unexpected error while performing partial evaluation:
[2016-01-28 13:02:14 - BRANCH_NOW] Class = [org/mozilla/javascript/tools/debugger/SwingGui]
[2016-01-28 13:02:14 - BRANCH_NOW] Method = [showStopLine(Lorg/mozilla/javascript/tools/debugger/Dim$StackFrame;)V]
[2016-01-28 13:02:14 - BRANCH_NOW] Exception = [java.lang.IllegalArgumentException] (Can't find any super classes of [org/mozilla/javascript/tools/debugger/FileWindow] (not even immediate super class [javax/swing/JInternalFrame]))
[2016-01-28 13:02:14 - BRANCH_NOW] java.lang.IllegalArgumentException: Can't find any super classes of [org/mozilla/javascript/tools/debugger/FileWindow] (not even immediate super class [javax/swing/JInternalFrame])
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.evaluation.value.ReferenceValue.generalize(ReferenceValue.java:299)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.evaluation.value.IdentifiedReferenceValue.generalize(IdentifiedReferenceValue.java:65)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.evaluation.value.ReferenceValue.generalize(ReferenceValue.java:481)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.evaluation.Variables.generalize(Variables.java:136)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.evaluation.TracedVariables.generalize(TracedVariables.java:118)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:682)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:602)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlockAndExceptionHandlers(PartialEvaluator.java:560)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute0(PartialEvaluator.java:264)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute(PartialEvaluator.java:181)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:91)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:504)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.ClassPool.classesAccept(ClassPool.java:116)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.Optimizer.execute(Optimizer.java:372)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.ProGuard.optimize(ProGuard.java:306)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.ProGuard.execute(ProGuard.java:115)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.ProGuard.main(ProGuard.java:492)
如何避免同样的情况?
JInternalFrame 不是 android 包的一部分,错误清楚地表明 "not even immediate super class"。
还发布了 Rhino SwingGui class 用于桌面 java 应用程序,而不是 android 应用程序。
从 Rhino src 中删除工具 src 并将 progaurd 应用到我的应用程序..
在我的 Android 项目中使用 rhino 库并尝试使用 proguard 不混淆 Rhino jar。 https://docs.oracle.com/javase/7/docs/api/javax/swing/JInternalFrame.html
JInternalFrame 不是 android 包的一部分..
proguard 设置:
# rhino (javascript)
-dontwarn org.mozilla.javascript.**
-dontwarn org.mozilla.classfile.**
-keep class org.mozilla.classfile.** { *; }
-keep class org.mozilla.javascript.* { *; }
-keep public class org.mozilla.javascript.tools.debugger.SwingGui.Dim$StackFrame { *; }
-keep class org.mozilla.javascript.tools.debugger.SwingGui.Dim$StackFrame { *; }
-keep class org.mozilla.javascript.tools.debugger.SwingGui.Dim$StackFrame { public protected *; }
-keep class org.mozilla.javascript.tools.debugger.SwingGui { *; }
-keep class org.mozilla.javascript.tools.debugger.SwingGui.* { *; }
-keep class org.mozilla.javascript.tools.debugger.SwingGui.** { *; }
-keep class org.mozilla.javascript.tools.debugger.** { *; }
-keep class org.mozilla.javascript.tools.debugger.FileWindow.* { *; }
-keep class org.mozilla.javascript.tools.debugger.** { *; }
-keep class org.mozilla.javascript.tools.** { *; }
-keep class org.mozilla.javascript.annotations.** { *; }
-keep class org.mozilla.javascript.ast.** { *; }
-keep class org.mozilla.javascript.commonjs.module.** { *; }
-keep class org.mozilla.javascript.commonjs.module.provider.** { *; }
-keep class org.mozilla.javascript.debug.** { *; }
-keep class org.mozilla.javascript.jdk13.** { *; }
-keep class org.mozilla.javascript.jdk15.** { *; }
-keep class org.mozilla.javascript.json.** { *; }
-keep class org.mozilla.javascript.optimizer.** { *; }
-keep class org.mozilla.javascript.regexp.** { *; }
-keep class org.mozilla.javascript.serialize.** { *; }
-keep class org.mozilla.javascript.typedarrays.** { *; }
-keep class org.mozilla.javascript.v8dtoa.** { *; }
-keep class org.mozilla.javascript.xml.** { *; }
-keep class org.mozilla.javascript.xmlimpl.** { *; }
-keep class org.apache.http.** { *; }
-keep class org.apache.commons.codec.** { *; }
-keep class org.apache.commons.logging.** { *; }
-keep class android.net.compatibility.** { *; }
-keep class android.net.http.** { *; }
-dontwarn org.apache.http.**
-dontwarn android.webkit.**
在 Eclipse 中导出未签名的 apk 时出现异常:
[2016-01-28 13:02:14 - BRANCH_NOW] Proguard returned with error code 1. See console
[2016-01-28 13:02:14 - BRANCH_NOW] Note: there were 4084 duplicate class definitions.
[2016-01-28 13:02:14 - BRANCH_NOW] You should check if you need to specify additional program jars.
[2016-01-28 13:02:14 - BRANCH_NOW] Unexpected error while performing partial evaluation:
[2016-01-28 13:02:14 - BRANCH_NOW] Class = [org/mozilla/javascript/tools/debugger/SwingGui]
[2016-01-28 13:02:14 - BRANCH_NOW] Method = [showStopLine(Lorg/mozilla/javascript/tools/debugger/Dim$StackFrame;)V]
[2016-01-28 13:02:14 - BRANCH_NOW] Exception = [java.lang.IllegalArgumentException] (Can't find any super classes of [org/mozilla/javascript/tools/debugger/FileWindow] (not even immediate super class [javax/swing/JInternalFrame]))
[2016-01-28 13:02:14 - BRANCH_NOW] java.lang.IllegalArgumentException: Can't find any super classes of [org/mozilla/javascript/tools/debugger/FileWindow] (not even immediate super class [javax/swing/JInternalFrame])
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.evaluation.value.ReferenceValue.generalize(ReferenceValue.java:299)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.evaluation.value.IdentifiedReferenceValue.generalize(IdentifiedReferenceValue.java:65)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.evaluation.value.ReferenceValue.generalize(ReferenceValue.java:481)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.evaluation.Variables.generalize(Variables.java:136)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.evaluation.TracedVariables.generalize(TracedVariables.java:118)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:682)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:602)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlockAndExceptionHandlers(PartialEvaluator.java:560)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute0(PartialEvaluator.java:264)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute(PartialEvaluator.java:181)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:91)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:504)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.classfile.ClassPool.classesAccept(ClassPool.java:116)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.optimize.Optimizer.execute(Optimizer.java:372)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.ProGuard.optimize(ProGuard.java:306)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.ProGuard.execute(ProGuard.java:115)
[2016-01-28 13:02:14 - BRANCH_NOW] at proguard.ProGuard.main(ProGuard.java:492)
如何避免同样的情况?
JInternalFrame 不是 android 包的一部分,错误清楚地表明 "not even immediate super class"。 还发布了 Rhino SwingGui class 用于桌面 java 应用程序,而不是 android 应用程序。 从 Rhino src 中删除工具 src 并将 progaurd 应用到我的应用程序..