【问题标题】:ProGuard keep class does not workProGuard 保持类不起作用
【发布时间】:2016-06-17 17:54:12
【问题描述】:

我有一个 jar 文件,我想用 ProGuard 混淆它。所有库都放入 jar 文件中,我想从混淆中排除库。当我尝试混淆时,我收到以下错误:

Unexpected error while performing partial evaluation:
  Class       = [com/google/common/cache/LongAddables]
  Method      = [<clinit>()V]
  Exception   = [java.lang.IllegalArgumentException] (Can't find common super class of [com/google/common/cache/LongAddables$2] (with 1 known super classes) and [com/google/common/cache/LongAddables$1] (with 1 known super classes))
Error: Can't find common super class of [com/google/common/cache/LongAddables$2] (with 1 known super classes) and [com/google/common/cache/LongAddables$1] (with 1 known super classes)

我的配置是这样的;

-injars       E:\project\celrond\out\artifacts\celrond-build.jar  
-outjars      E:\project\celrond\out\artifacts\celrond-build_obf.jar

-keep class com.google.** { *; }  
-keep class org.h2.** { *; }  
-keep class org.apache.** { *; }  
-keep class com.sun.** { *; }  
-keep class com.j256.** { *; }  
-keep class org.eclipse.** { *; }  
-keep class com.ibm.** { *; }  
-keep public class celrond.MyMain {  
    public static void main(java.lang.String[]);  

我找不到我的错误,任何帮助都会很棒!

【问题讨论】:

    标签: java proguard obfuscation


    【解决方案1】:

    看起来 guava 库作为 libraryjar 丢失了。是否将所有依赖库打包到文件celron-build.jar 中?如果没有,那么您需要将它们指定为

    -libraryjars path/to/library.jar
    

    【讨论】:

    • 我已将所有依赖库打包到我的jar文件中。我可以毫无问题地使用“java -jar celron-build.jar”命令运行我的程序。
    • 您能否验证类 com.google.common.base.Supplier 是否存在?您还可以发布任何警告 ProGuard 输出,这可能表明问题的根源。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-13
    • 1970-01-01
    • 1970-01-01
    • 2015-08-16
    • 1970-01-01
    • 1970-01-01
    • 2013-07-23
    相关资源
    最近更新 更多