gpt4 book ai didi

java - ProGuard 错误 : The output jar is empty. 您是否指定了正确的 '-keep' 选项?

转载 作者:搜寻专家 更新时间:2023-11-01 07:52:36 25 4
gpt4 key购买 nike

我正在像这样从命令行使用 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?

如何解决这个错误?

最佳答案

不要压缩库文件。这对我有用;

    # Keep - Library. Keep all public and protected classes, fields, and methods.
-keep public class * {
public protected <fields>;
public protected <methods>;
}

关于java - ProGuard 错误 : The output jar is empty. 您是否指定了正确的 '-keep' 选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32770981/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com