Android project code obfuscation

Source: Internet
Author: User

By default, Android projects in Eclipse use Proguard (http://proguard.sourceforge.net/) to confuse project code files.
 
The usage is simple:
1. Add proguard. config = proguard. cfg to the default. properties file.
2. Configure the proguard parameter in Proguard. cfg. (If this file is not available, create one in the src directory .)
3. Export the apk file to get the mixed file.
The method described above is simple and can be used simply by simple settings.
 
If you find that some functions of the application cannot be used normally after obfuscation of the project, you need to carefully find the cause to see why the application cannot be used after obfuscation, and then configure the Proguard parameter file.
 
For example.
For example, if the-ing is used in the project, the-keep parameter is used to keep the classes used for the ing intact, so that these classes are not obfuscated. Otherwise, these classes cannot be found after the ing.
For example, if Annotation is used in the project, you must-keepattributes * Annotation * to retain Annotation. Otherwise, some codes in the project cannot be used after obfuscation.
 
There is another experience.
The Proguard parameters are complex and sometimes cannot be intuitively understood. In this case, you can use the GUI program provided by Proguard to configure parameters in the GUI and export them as a configuration file. Then open the file in text mode, and you will be able to see how each parameter is written.

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.