Android uses proguard for code obfuscation

Source: Internet
Author: User

I. What have code obfuscation been done?
1. code obfuscation is usually used to remove unnecessary Code. It is used to rename classes, attributes, and methods with obscure names to reduce the size of the Code, increase the difficulty of decompilation. (If our applications are charged or kept confidential, we need to improve the security of our code through code obfuscation)
2. Enable ProGuard in Eclipse
1. Check whether the proguard folder exists in the Android SDK directory.
For example, my own D: \ Environment \ android-sdk-windows \ tools \ proguard
2. Configuration
1) Check whether proguard exists in the root directory of the project. cfg file. If it does not exist (indicating that the current project is a project earlier than 2.3), you need to create a 2.3 android project from which proguard. copy the cfg file to the root directory of your project without any changes (unless you understand how to customize your obfuscation Policy). Continue with the following steps.
2) If yes, find default in the root directory of the project. properties [if you are using ADT14 or a later version, there is no default in the project. properties file, only project. properties file, find the project. properties file] File, add a configuration in the file: proguard. config = proguard. cfg
This completes the configuration, isn't it easy. In the future, this project APK packaged using Eclipse will be confused. The following three, four, and five are some error solutions and detailed documents.
Iii. Possible Errors
1. the following error may occur during APK packaging:
Conversion to Dalvik format failed with error 1
Solution:
Open proguard. bat in the Android SDK installation directory and modify the following:
 
Call % java_exe %-jar "% PROGUARD_HOME %" \ lib \ proguard. jar % *
Change
Call % java_exe %-jar "% PROGUARD_HOME %" \ lib \ proguard. jar % 1% 2% 3% 4% 5% 6% 7% 8% 9
 
4. Open-source code obfuscation tool ProGuard
1. project documentation: (if you want to customize your own obfuscation policies, you should understand them here)
Http://proguard.sourceforge.net/index.html#manual/introduction.html
5. Integrate the ProGuard tool in Android to implement code obfuscation
1. Android ProGuard User Guide
Guide for windows:
Android-sdk-windows/docs/guide/developing/tools/proguard.html
Location in Google online DevGuid:
Http://developer.android.com/guide/developing/tools/proguard.html

 


Excerpt from sunk silence

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.