Java Proguard Obfuscation code to prevent decompile

Source: Internet
Author: User

Proguard5.3:http://down.51cto.com/data/2316123

    1. Export the project's jar package from eclipse (this is not in detail)

    2. After installing Proguard, open the Proguardgui.bat boot Proguard in the bin directory as shown in:

      650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/98/77/wKiom1k83qODmhxGAAF7zv--7a8360.png-wh_500x0-wm_ 3-wmp_4-s_457768812.png "style=" Float:none; "title=" 1.png "alt=" Wkiom1k83qodmhxgaaf7zv--7a8360.png-wh_50 "/>

    3. Click Input/output, set the input and output jar package, input is the original jar,output is the jar after the confusion.

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/98/77/wKiom1k83qjCSs7JAAFuhrR5NZI272.png-wh_500x0-wm_ 3-wmp_4-s_3600365826.png "style=" Float:none; "title=" 2.png "alt=" Wkiom1k83qjcss7jaafuhrr5nzi272.png-wh_50 "/>

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/98/77/wKioL1k83qzyiIgVAAF_nM-rwU4981.png-wh_500x0-wm_ 3-wmp_4-s_2425624761.png "style=" Float:none; "title=" 3.png "alt=" Wkiol1k83qzyiigvaaf_nm-rwu4981.png-wh_50 "/>

5. Click Add in Input/output, adding the jar that the project uses, including the JRE, and all the jar packages in the Lib under Web-info, which, if the jar is missing, can be confused with an error. (You can copy the required jar package to a folder first) as shown in:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/98/77/wKioL1k85D2AcdKwAAFCEOekkHs556.png-wh_500x0-wm_ 3-wmp_4-s_3520693984.png "title=" 10.png "alt=" Wkiol1k85d2acdkwaafceoekkhs556.png-wh_50 "/>

6. Click on the shrinking configuration as shown:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/98/77/wKioL1k83rDyaFzKAAEzMTTbrxU017.png-wh_500x0-wm_ 3-wmp_4-s_3689045389.png "style=" Float:none; "title=" 4.png "alt=" Wkiol1k83rdyafzkaaezmttbrxu017.png-wh_50 "/>

7. Click on the obfuscation configuration as shown:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/98/77/wKiom1k83rThlfXcAAF1WKs1PnU409.png-wh_500x0-wm_ 3-wmp_4-s_3658463043.png "style=" Float:none; "title=" 5.png "alt=" Wkiom1k83rthlfxcaaf1wks1pnu409.png-wh_50 "/>

8. Click on the optimization configuration as shown:

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/98/77/wKiom1k83rjhlYGFAAE5O4oodE4012.png-wh_500x0-wm_ 3-wmp_4-s_2358263347.png "style=" Float:none; "title=" 6.png "alt=" Wkiom1k83rjhlygfaae5o4oode4012.png-wh_50 "/>

9. Click on the information configuration as shown:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/98/77/wKioL1k83rzRTkkgAAE_sr-i0Ck413.png-wh_500x0-wm_ 3-wmp_4-s_2489683081.png "style=" Float:none; "title=" 7.png "alt=" Wkiol1k83rzrtkkgaae_sr-i0ck413.png-wh_50 "/>

10. Click the Save Configuration button in the Process column to save the pro format profile as shown in:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/98/77/wKiom1k83r7BICO7AAE-dhGndOY532.png-wh_500x0-wm_ 3-wmp_4-s_3854068549.png "style=" Float:none; "title=" 8.png "alt=" Wkiom1k83r7bico7aae-dhgndoy532.png-wh_50 "/>

11. Open the Pro file you just saved with a text editor and modify it. As in the following example:

Add the following code:

-keep public class com.cn.a{

*;

}

Represents the retention of Class A and all properties, methods of the class

-keep public class com.cn.b{

public String name;

public static void Methoada (int,int,java.lang.string);

public static void Methoadb (int,int,java.lang.string);

}

Represents a reservation to the Name property, Instantday, and Instantmonth methods of the Outputfrecast

There are a number of rules that you can refer to Proguard using the documentation.

12. Close the Proguard window and reopen

13. Click the Load Configuration button in the Proguard column to find the pro file saved in 10

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/98/78/wKioL1k85K3wAQTVAAF78C2qKwE345.png-wh_500x0-wm_ 3-wmp_4-s_4114207217.png "style=" Float:none; "title=" 9.png "alt=" Wkiol1k85k3waqtvaaf78c2qkwe345.png-wh_50 "/>


14. Click the Process button in the process bar to confuse it, as shown in success:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/98/78/wKiom1k85gmh9zrWAAIo55h39ng665.png-wh_500x0-wm_ 3-wmp_4-s_2867646049.png "title=" 11.png "alt=" Wkiom1k85gmh9zrwaaio55h39ng665.png-wh_50 "/>



Java Proguard Obfuscation code to prevent decompile

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.