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"