Android code obfuscation

Source: Internet
Author: User

Android code obfuscation
1. proguard. cfg. This is the proguard script required for obfuscation.
 
The Code is as follows:
 
 
View plain
-Optimizationpasses 5
-Dontusemixedcaseclassnames
-Dontskipnonpubliclibraryclasses
-Dontpreverify
-Verbose
-Optimizations! Code/simplification/arithmetic ,! Field /*,! Class/merging /*
-Keep public class * extends android. app. Activity
-Keep public class * extends android. app. Application
-Keep public class * extends android. app. Service
-Keep public class * extends android. content. BroadcastReceiver
-Keep public class * extends android. content. ContentProvider
-Keep public class com. android. vending. licensing. ILicensingService
-Keepclasseswithmembernames class *{
Native <methods>;
}
-Keepclasseswithmembernames class *{
Public <init> (android. content. Context, android. util. AttributeSet );
}
-Keepclasseswithmembernames class *{
Public <init> (android. content. Context, android. util. AttributeSet, int );
}
-Keepclassmembers enum *{
Public static ** [] values ();
Public static ** valueOf (java. lang. String );
}
-Keep class * implements android. OS. Parcelable {
Public static final android. OS. Parcelable $ Creator *;
}
 
 
As you can see from the script, obfuscation retains the basic components inherited from Activity, Service, Application, BroadcastReceiver, ContentProvider, and so on.
All Native variable names and class names are retained. All classes Use constructors with fixed parameter formats, such as enumeration. (For more information, see examples and comments in <proguard_path>/examples .)
2. Add the following phrase "proguard. config = proguard. cfg" to "default. properties" of the project"
 
 
The. APK behind the package signature is obfuscated. In fact, we only need to do one step to add such a sentence "proguard. config = proguard. cfg" in "default. properties.

Author "liangoogle"
 

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.