As is known to all, the Android apk file is very easy to decompile, so for developers, hard to develop the application is a frustrating thing, Google also recognized this, So since 2.3, a code obfuscation tool has been provided for developers, and the new version of ADT-created projects will have more than two code obfuscation files by default, Proguard.
Proguard.cfg is the legendary confusion script, the specific content is as follows:
-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 * extends Android.app.backup.BackupAgentHelper
-keep public class * extends Android.preference.Preference
-keep public class Com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
Native <methods>;
}
-keepclasseswithmembers class * {
Public <init> (Android.content.Context, Android.util.AttributeSet);
}
-keepclasseswithmembers class * {
Public <init> (Android.content.Context, Android.util.AttributeSet, int.);
}
-keepclassmembers class * extends Android.app.Activity {
public void * (Android.view.View);
}
-keepclassmembers enum * {
public static **[] values ();
public static * * VALUEOF (java.lang.String);
}
-keep class * Implements Android.os.Parcelable {
public static final Android.os.parcelable$creator *;
}
If your project introduces Google's extra support package (for example, Android-support-v4.jar), you can add a sentence to the script
-dontwarn android.support.**
If your project has a third-party support package, you can add it to the script above by referencing the following format:
-libraryjars Libs/base64coder.jar
Well, the configuration of the above file script even if completed, the rest of the work is to get the script to take effect, the default confusion is not open, you need to add a sentence in the project.properties file proguard.config=proguard.cfg to take effect ;
Finally, by exporting and signing, your apk is confused, and below is:
Android Development--confusing compilation