Current location - Quotes Website - Personality signature - What is code obfuscation? How to enable code obfuscation in andriod and android-studio projects?
What is code obfuscation? How to enable code obfuscation in andriod and android-studio projects?
Code obfuscation has two important functions. First, confuse the code. Second, optimize the code.

A program that confuses code is called an obfuscator. The significance of code confusion mainly lies in encrypting the code to a certain extent.

After android 2.3, the obfuscator proguard has been integrated into the sdk (the directory is in sdk\tools\proguard), so we can easily start code obfuscation directly in the project.

Eclipse android project turns on the obfuscation function. We need to manually add the following code to the project file. Properties (mine is the project.properties file).

# To make ProGuard shrink and confuse your code, please uncomment it (available properties: sdk.dir, user.home):

proguard . config = $ { SDK . dir }/tools/proguard/proguard-Android . txt:proguard-project . txt

A project created in some way may already look like the above two lines, but it is commented out by default. Just uncomment the proguard.config line, which turns on the code obfuscation function. When the package is signed, the project will automatically obfuscate the code.