简体   繁体   English

-keep class和-dontwarn有什么区别

[英]what is the difference between -keep class and -dontwarn

Hey I'm new with proGuard , I use it to protect my code from reverse engineering , but when I built my signed apk I got a lot of errors when I enabled proGuard ,I have googled my problem I've found answers that says use -dontwarn for the classes that showing in the error message but after seeing the documentation from proGuard it says 嘿,我是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. 如果您不想过滤掉有问题的课程,可以尝试使用-ignorewarnings选项,甚至是-dontwarn选项。 Only use these options if you really know what you're doing though. 如果您真的知道自己在做什么,请仅使用这些选项

and I don't know what I'm doing and here is my proguard-rules.pro file 我不知道我在做什么,这是我的proguard-rules.pro文件

-dontwarn okio.**
-dontwarn org.apache.**
-dontwarn com.appodeal.**
-dontwarn com.parse.**
-dontwarn com.squareup.**

and I've seen some answers says use -keep class 我看到一些答案说使用-keep class

so can someone explain it 有人可以解释一下

-keep class Preserve the specified classes and class members. -keep class保留指定的类和类成员。

-dontwarn Don't warn about unresolved references at all. -dontwarn不要警告未解决的引用。

More info here http://proguard.sourceforge.net/manual/refcard.html 更多信息,请访问http://proguard.sourceforge.net/manual/refcard.html

-dontwarn

Specifies not to warn about unresolved references and other important problems at all. 指定不要警告未解决的引用和其他重要问题。 The optional filter is a regular expression; 可选过滤器是正则表达式; ProGuard doesn't print warnings about classes with matching names. ProGuard不会打印有关匹配名称的类的警告。 Ignoring warnings can be dangerous. 忽略警告可能很危险。 For instance, if the unresolved classes or class members are indeed required for processing, the processed code will not function properly. 例如,如果确实需要处理未解析的类或类成员,则处理的代码将无法正常运行。 Only use this option if you know what you're doing! 如果您知道自己在做什么,请仅使用此选项!

-keep class

Specifies classes and class members (fields and methods) to be preserved as entry points to your code. 指定要保留为代码入口点的类和类成员(字段和方法)。 For example, in order to keep an application, you can specify the main class along with its main method. 例如,为了保留应用程序,您可以指定主类及其主方法。 In order to process a library, you should specify all publicly accessible elements. 要处理库,您应指定所有可公开访问的元素。

Hope this Helps!! 希望这可以帮助!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么尽管有-dontwarn和-keep类,ProGuard仍然会发出警告? - Why does ProGuard still warn despite -dontwarn and -keep class? -keep类com.sample.Foo {*;}和-keep类com.sample.Foo有什么区别? - What's the difference between -keep class com.sample.Foo {*;} and -keep class com.sample.Foo? proguard - keep 和 keep { } 语句有什么区别? - proguard - what is difference between - keep and keep { } statement? &#39;-keep class ab **&#39;和&#39;-keep class ab ** {}&#39;之间的区别 - Difference between '-keep class a.b.**' and '-keep class a.b.** {}' ProGuard中-keep和-keepclassmembers有什么区别? - What is the difference between -keep and -keepclassmembers in ProGuard? Class &lt;*&gt;和Class有什么区别<T> - What's the difference between Class<*> and Class<T> 在proguard android上,此警告的-dontwarn规则是什么? - What can be the -dontwarn rule for this warning on proguard android? 用这两种方式指定一个类有什么区别? - What is the difference between specifying a class in these two ways? Flutter 中的 initState 和类构造函数有什么区别? - What is the difference between initState and a class constructor in Flutter? ViewModelProviders 和 ViewModelProvider 类有什么区别? - What is the difference between ViewModelProviders and ViewModelProvider class?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM