单jar运行proguard的问题 - 找不到java类

时间:2015-02-11 11:54:37

标签: java jar proguard

我正在尝试使用Proguard优化jar

我的配置:

    -injars       MyLib-1.0.jar
    -outjars      MyLib-1.0.proguard.jar
    -libraryjars  retrace.jar
    -libraryjars  guava-18.0.jar
    -printmapping MyLib.map

    -keep public class MyLib {
        public String myPublicCallEntryPoint(java.lang.String);
    }

    -keep public class * {
        public protected *;
    }

    -keepclassmembernames class * {
        java.lang.Class class$(java.lang.String);
        java.lang.Class class$(java.lang.String, boolean);
    }

然后我用:java -jar proguard.jar @myconfig.pro -verbose

运行它

日志输出:

Initializing...
Note: the configuration refers to the unknown class 'String'
Note: the configuration refers to the unknown class 'java.lang.String'
Note: the configuration refers to the unknown class 'java.lang.Class'
Note: the configuration refers to the unknown class 'java.lang.String'
Note: the configuration refers to the unknown class 'java.lang.Class'
Note: the configuration refers to the unknown class 'java.lang.String'

有没有办法防止这样的事情?我如何告诉proguard识别基类java类?

1 个答案:

答案 0 :(得分:0)

问题在于我从JRE中错误地将rt.jar误认为是来自proguard包的回溯。