Android Development Code obfuscation experience (Eclipse)

Source: Internet
Author: User

In order to prevent the results of their own work stolen by others, confusing code can effectively prevent the anti-compilation, the following to summarize the following steps to confuse the code:

2, edit the Proguard-project.txt under the project, add the rules that do not need to be confused (model, generics, reflection, third-party jar package), the contents of the Proguard-project.txt file are as follows:

# To enable Proguard in your project, edit project.properties# to define the Proguard.config property as described in That file.## ADD project specific Proguard rules here.# bydefault, the flags in Thisfile is appended to the flags specified# in ${sdk.dir}/tools/proguard/proguard-android.txt# You can edit the include path and order by changing the proguard# include property in Project.Properties. # for more details, see# http://developer.android.com/guide/developing/tools/proguard.html# ADD any project specific keep options here:# If your project uses WebView with JS, uncomment the following# and spec Ify the fully qualifiedclassName to the JavaScriptInterface# class:#-keepclassmembersclassFqcn.of.javascript.Interface. for. WebView {# Public*#}############################################## The main program cannot confuse the code ################################################ ####-dontwarn xxx.model.**######-keepclassxxx.model.** {*; } ################################################ non-optimized generics and reflection ###############################################-keepattributes Signature-keepclass*extendsjava.lang.annotation.Annotation {*; } ############################################## does not confuse third-party libraries or jar packages ############################################-dontwarn Net.sourceforge.jtds.**-keepclassnet.sourceforge.jtds.** {*; }-dontwarn Com.iflytek.speech.**-keepclasscom.iflytek.speech.** {*; }-dontwarn Com.lidroid.xutils.**-keepclasscom.lidroid.xutils.** {*; } #####################################

Tip: The third-party jar package name can be used winrar to open the jar file and get the package path. For example: Jtds-1.2.jar, with winrar view, you can find the package name: Net.sourceforge.jtds, so you just add the following 2 lines of code, you can not confuse the jar file related packages and classes:

class net.sourceforge.jtds.** {*;}



Reference article:
1, http://blog.csdn.net/lovexjyong/article/details/24652085
2, http://www.cnblogs.com/qianxudetianxia/p/4948499.html


Android Development Code obfuscation experience (Eclipse)

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.