关于android:-keep类和-dontwarn有什么区别

what is the difference between -keep class and -dontwarn

嘿,我是proGuard的新手,我用它来保护代码免受逆向工程的侵害,
但是,当我构建签名的apk时,启用proGuard时出现很多错误,我用谷歌搜索了我的问题,找到了对错误消息中显示的类使用-dontwarn的答案,但在查看了proGuard的文档后说

If you don't feel like filtering out the problematic classes, you can try your luck with the -ignorewarnings option, or even the -dontwarn option. Only use these options if you really know what you're doing though.

我不知道我在做什么
这是我的proguard-rules.pro文件

1
2
3
4
5
-dontwarn okio.**
-dontwarn org.apache.**
-dontwarn com.appodeal.**
-dontwarn com.parse.**
-dontwarn com.squareup.**

我已经看到一些答案说使用-keep class

所以有人可以解释它


-keep class保留指定的类和类成员。

-dontwarn
完全不要警告未解决的引用。

此处提供更多信息http://proguard.sourceforge.net/manual/refcard.html


1
-dontwarn

指定根本不警告未解决的引用和其他重要问题。可选过滤器是一个正则表达式; ProGuard不会打印有关名称匹配的类的警告。忽视警告可能很危险。例如,如果确实需要未解析的类或类成员进行处理,则处理后的代码将无法正常运行。仅当您知道自己在做什么时才使用此选项!

1
-keep class

指定要保存为代码入口点的类和类成员(字段和方法)。例如,为了保留应用程序,您可以指定主类及其主方法。为了处理库,您应该指定所有可公开访问的元素。

希望这会有所帮助!