Use proguard to confuse JAVA Source Code 2-main parameter description

Source: Internet
Author: User

Java code is easily decompiled. The following uses proguard to protect our code:

Proguard has many options and is easy to confuse. Now I will write down my configuration (in actual use) for your reference.

 

Download proguard to http://proguard.sourceforge.net

(If you cannot download the proguardprogram, go to http://download.csdn.net/detail/odian1/4103373to download it)

Input/OutputTags:

Here, select the code directory to be obfuscated and the code directory to be output after obfuscation and all lib packages required by the project. The code to be obfuscated can be packaged in jar, war, ear, zip, or other formats, or you can directly specify the code directory (in this case, be sure to specify the Code as the package directory at the top ).

Add input to add the code to be obfuscated.

"Add output" specifies the output path and format

Edit settings

Filter filters unwanted files and packages

"Remove" to delete unnecessary files and packages

"Move up" and "Move Down" will set the position for moving the display.

Move to libraries to the Lib required by the project

Move to program to move to project

The "add" in the lower part is the Lib package required to add the project. If it is a web project, add the J2EE package to the Lib.

Shrinking, OptimizationTags:

Proguard can compress and optimize code, delete useless classes, fields, and methods, and optimize code. Not much here,

The main explanation is as follows:ObfuscationLabel.

"Obfuscate" is available only when the obfuscation mechanism is selected.

"Print mapping" outputs the ing file, including the class name, method name, and attribute name before and after obfuscation.

The "Apply mapping" application ing file can specify the class name, method name, and attribute name after obfuscation.

"Obfuscation Dictionary" obfuscation dictionary, which specifies the characters used for obfuscation.

Overlord aggressively

"Use unique class member names" uses a unique class member name

"Default package" Default package name

"Use mixed-case class names" uses the mixed class name, so that different classes are obfuscated and the same class name will be used.

"Keep attributes" specifies the resource file whose attributes need to be retained

Rename sourcefile attribute rename the resource file attribute

"Keep names" reserved name

"Native method names" local method name

". Class method names" specifies the class to save the method name

"Keep additional class names and class member names" retains (no need to confuse) the class name and member name

Click "add" or "edit" to edit the class to be retained.

"Comments"You can add Optional comments to the current entry in the text field. This comment identifies the entry in the list and appears in the configuration file as a comment.

"Keep classes and class members" retains the class name and member name

"Keep class members only" only retains the member name

"Keep classes and class members, if Members are present"

"Access" access modifier, specifying the modifier of the class to be retained

"Class" specifies the class name. You can use the "*" wildcard to specify the class name, for example, "* Number *"

Class inherited and implemented by "extends/implements class". You must specify the full path of the class, including the package name.

Member to be retained by "Class Members"

"Add field" adds attributes to be retained and is configured by specifying modifiers, types, and names.

"Add method" adds the owner method to be retained. It is configured by specifying the modifier, return type, and name.

Information(Parameter information) label:

Consistency and correctness consistency and correctness

"Print seeds" to print logs

"Verbose" Details

Warning when "warn about missing libraries" lacks Class Libraries

"Ignore warnings about missing libraries" ignores warnings of missing class libraries. Sometimes some class libraries are obfuscated. proguard advocates eliminating all warnings and then obfuscation.

"Skip non-public library classes" skips all non-public classes and speeds up loading Lib.

"Skip Non-Public Library Class Members" skips all non-common methods to accelerate lib parsing.

"Why are u keeping"

ProcessTags:

View Configuration

Save Configuration

Retrace(Anti-tracking) Label

To put it simply, the keep parameter is used to set the classes and members that do not participate in obfuscation.

KeepClass_specificationRetain the specified class and member name and content

KeepclassmembersClass_specificationOnly the names and content of specified class members are retained.

KeepclasseswithmembersClass_specification

KeepnamesClass_specificationKeep the class and member names and confuse the content

KeepclassmembernamesClass_specificationOnly keep Member names, obfuscated content

KeepclasseswithmembernamesClass_specification

Source: http://blog.csdn.net/lpdx111/article/details/7659218

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.