what is the difference between -keep class and -dontwarn

不问归期 提交于 2019-12-06 23:04:30

问题


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

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.

and I don't know what I'm doing and here is my proguard-rules.pro file

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

and I've seen some answers says use -keep class

so can someone explain it


回答1:


-keep class Preserve the specified classes and class members.

-dontwarn Don't warn about unresolved references at all.

More info here http://proguard.sourceforge.net/manual/refcard.html




回答2:


-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. 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!!



来源:https://stackoverflow.com/questions/35268287/what-is-the-difference-between-keep-class-and-dontwarn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!