Rules for code obfuscation

Source: Internet
Author: User

Rules for code obfuscation
1. If you use a tool such as Gson to make the JavaBean class the entity class not to be confused.

2. If you are using custom controls then make sure they are not involved in the confusion.

3. If an enumeration is used, the enumeration is guaranteed not to be confused.
-keepclassmembers enum * {--enum class cannot be confused
public static **[] values ();
public static * * VALUEOF (java.lang.String);
}
4. Do not confuse classes in third-party libraries

A. Confusing third-party jar packages that protect references
Like what:
-libraryjars Libs/gson-2.0.jar
-libraryjars Libs/universal-image-loader-1.9.0.jar
5. Local methods cannot be confused
-keepclasseswithmembernames class * {All native methods cannot be confused.
Native <methods>;
}


Other common confusion

-keep class android.support.v4.**{*;}
-keepclassmembers class * {
Public <init> (Org.json.JSONObject);
}

-keepclasseswithmembers class * {
Public <init> (Android.content.Context, Android.util.AttributeSet); --some construction methods cannot be confused
}

Rules for code obfuscation

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.