To prevent the code from being deserialized, you need to add confusion. Confusion can also be confused by a third-party apk, or by Proguard in Android.
Obfuscation steps:
1, configuration confusion file, the name can be arbitrary, here to use proguard-android, the format is txt.
-optimizationpasses 5 # Specifies the compression level of the Code-dontusemixedcaseclassnames # Whether to use case mixed-dontskipnonpubliclibraryclasses # whether to confuse third party jar-dontpreverify # If you do a pre-check- Verbose # whether to log-optimizations when confused!code/simplificat ion/arithmetic,!field/*,!class/merging/* # The algorithm used to confuse-keep public class * extends Android.app.Activity # Keep What classes are not confused-keep public class * extends Android.app.Application # Keep What classes are not confused-ke EP public class * extends Android.app.Service # Keep What classes are not confused-keep public class * extends Andro Id.content.BroadcastReceiver # Keep What classes are not confused-keep public class * extends Android.content.ContentProvider # Keep What classes are notConfuse-keep public class * extends Android.app.backup.BackupAgentHelper # Keep What classes are not confused-keep public class * extends Android.preference.Preference # Keep What classes are not confused-keep public class Com.android.vending.licensing.ILicensingS Ervice # Keep What classes are not confused-libraryjars Libs/gson-2.0.jar # Keep A third-party jar Not to be confused-keepclasseswithmembernames class * {# Keep Native method not to be confused native <metho Ds>;} -keepclasseswithmembers class * {# Keep custom control classes from being confused with public <init> (Android Oid.content.Context, Android.util.AttributeSet);} -keepclasseswithmembers class * {public <init> (Android.content.Context, android.util.AttributeSet, int); # Keep custom control classes from being confused}-keepclassmembers class * extends android.app.Activity {# Keep custom control classes from being confused with public voi D * (Android.view.View);} -keepclassmembers enum * { # keep Enum enum class not to be confused public static **[] values (); public static * * VALUEOF (java.lang.String);} -keep class * Implements android.os.Parcelable {# Keep Parcelable not confused public static final Android.os.parcelable$creator *;} -keepclassmembers class * *. r$* {# Keep R file is not confused with public static <fields>} -keep class com.alipay.android.app.ialipay{*;} # Keep an interface or class from being confused-keep class com.android.app.view**{*;} # Keep all classes under a package not to be confused-keep class com.android.app.commoncallback{# keeps members and methods of the public and protected type of a class or interface from being Confuse public protected <fields>; public protected <methods>;} -keep Class com.android.app.platform$*{# Keep The inner class from being confused *;} #-keep class com.android.app.** implements Com.android.app.platform$icallback {*;} # Keep The internal interface not being confused-dontwarn android.support.**
2. Introduction
Add Proguard.config=proguard-android.txt to the project's Project.Properties file, which is the confusing file written above.
3, the Android default operating environment is the debug mode, is not to execute code confusion. Therefore, you must sign the project so that if you encounter an error while packaging, there may be a problem confusing the file where it was written.
Reference
http://blog.csdn.net/lovexjyong/article/details/24652085
Android code obfuscation prevents anti-compilation