我在命令行中使用ProGuard,如下所示:
java -jar $PRO_GUARD_HOME/proguard.jar @proguard-rules.pro > usage.log
以下是我的proguard-rules.pro
规则文件:
-injars build/libs/test-main-1.0.jar
-libraryjars /System/Library/Frameworks/JavaVM.framework/Classes/classes.jar
-dontoptimize
-dontobfuscate
-dontpreverify
-printusage
-dontnote
-keep public class com.foo.app.Main {
public static void main(java.lang.String[]);
}
-keepclassmembers class * {
static final % *;
static final java.lang.String *;
}
当我运行上面的命令时,我收到以下错误:
Error: The output jar is empty. Did you specify the proper '-keep' options?
如何解决此错误?
答案 0 :(得分:3)
不要缩小库文件。这对我有用;
# Keep - Library. Keep all public and protected classes, fields, and methods.
-keep public class * {
public protected <fields>;
public protected <methods>;
}