Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 875
IT Developers Avatar asked Feb 08 '16 11:02

IT Developers


People also ask

What is difference between class and object with example?

Class is a blueprint or template from which objects are created. Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc. Class is a group of similar objects. Object is a physical entity.

What's the difference between type and class?

The class defines object's internal state and the implementation of its operations. In contrast, an object's type only refers to its interface - a set of requests to which it can respond. An object can have many types, and objects of different classes can have the same type. Save this answer.

What is difference between class and struct?

Difference between Structs and Classes: Struct are value types whereas Classes are reference types. Structs are stored on the stack whereas Classes are stored on the heap. Value types hold their value in memory where they are declared, but a reference type holds a reference to an object in memory.


2 Answers

-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

like image 95
Prokky Avatar answered Nov 16 '22 01:11

Prokky


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

like image 45
PN10 Avatar answered Nov 16 '22 01:11

PN10