Android obfuscation proguard. cfg

Source: Internet
Author: User

-Optimizationpasses 5

-Dontusemixedcaseclassnames: [classes of different types are not generated during obfuscation]

-Dontskipnonpubliclibraryclasses [specify not to ignore non-public library classes. ]

-Dontpreverify [no pre-verification]

-Verbose

-Optimizations! Code/simplification/arithmetic ,! Field /*,! Class/merging/* [optimization]

-Keep public class * extends Android. App. Activity [unchanged without obfuscation]

-Keep public class * extends Android. App. Application

-Keep public class * extends Android. App. Service

-Keep public class * extends Android. content. broadcastreceiver

-Keep public class * extends Android. content. contentprovider

-Keep public class * extends Android. App. Backup. backupagenthelper

-Keep public class * extends Android. Preference. Preference

-Keep public class com. Android. Vending. Licensing. ilicensingservice

-Keep public abstract interface com. asqw. Android. Listener {

Public protected <Methods>; [do not confuse all methods]

}

-Keep public class com. asqw. Android {

Public void start (Java. Lang. String); [do not confuse this method]

}

-Keepclasseswithmembernames class * {[Protect the name of the specified class and class member. If all specified class members are present (after the compression step )]

Native <Methods>;

}

-Keepclasseswithmembers class * {[protect the members of the specified class and class, but the condition is that all specified Class and Class Members must exist .]

Public <init> (Android. content. Context, Android. util. attributeset );

}

-Keepclasseswithmembers class *{

Public <init> (Android. content. Context, Android. util. attributeset, INT );

}

-Keepclassmembers class * extends Android. App. Activity {[protect members of a specified class. If this class is protected, it will be better protected]

Public void * (Android. View. View );

}

-Keepclassmembers Enum *{

Public static ** [] values ();

Public static ** valueof (Java. Lang. String );

}

-Keep class * implements Android. OS. parcelable {[Protect specified class files and class members]

Public static final Android. OS. parcelable $ creator *;

}


Reference: http://blog.csdn.net/vrix/article/details/7100841


Several exceptions often occur after a third-party jar package is added:

Proguard returned with error code 1.see Console

Case 1:
Proguard returned with error code 1. See Console
Error: C:/documents (the specified file cannot be found)
Later, it was found that the entire project was placed on the desktop, and the desktop directory was C:/Documents and Settings/Administrator/desktop, where there was a space, when proguard is used for sending and compiling, spaces are not allowed.
If the correct path is not easy to use, simply delete proguard.

Note: It is best not to have a space character in the SDK and program path.

Case 2:

Proguard returned with error code 1. See Console
Exception:

Java. Lang. arrayindexoutofboundsexception

Solution: Set"-Dontpreverify"-Dontoptimize"

Reference: http://groups.google.com/group/android-developers/browse_thread/thread/eca3b0f5ce6ad00f


I deleted the proguard folder generated in the project (the folder is empty at this time), and then re-run the project, it will be OK.

 

Case 3:

The Reference Path of the third-party jar is incorrect. The jar package that needs to be ignored is not found. Reference: http://stackoverflow.com/questions/4884456/android-proguard-java-io-ioexception-cant-read-proguard-classpathentry
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.