Android Code obfuscation
In Build.grandle Add, where rules are written in Proguard-rules.pro, you can also customize a file to replace it, such as Eclipse's common Proguard-project.txt
buildTypes { release { signingConfig signingConfigs.release minifyEnabled true proguardFiles getDefaultProguardFile(‘proguard-android.txt‘), ‘proguard-rules.pro‘ }}
Add the following code to the Proguard-rules.pro to basically cover all
-optimizationpasses 5 # Specifies the compression level of the Code-dontusemixedcaseclassnames # whether to use case blending-dontpreverify # obfuscation If you do a pre-check-ve Rbose # The algorithm used to log-optimizations!code/simplification/arithmetic,!field/*,!class/merging/* # confusion when confused-keep public class * Extends Android.app.Activity # Keep What classes are not confused-keep public class * extends Android.app.Application # Keep what Class is not confused-keep public class * extends Android.app.Service # Keep What classes are not confused-keep public class * extends ANDROID.CONTENT.BROADC Astreceiver # Keep What classes are not confused-keep public class * extends Android.content.ContentProvider # Keep What classes are not confused-keep public class * EX Tends 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.ILicensingService # Keep What classes are not confused-keepclasseswithmembernames Class * {# Keep Native method not to be confused native <methods>;} -keepclasseswithmembers class * {# Keep custom control classes from being confused with public <init> (Android.content.Context, android.util.AttributeSet);} -keepclasseswithmembers class * {# Keep custom control classes from being confused with public <init> (Android.content.Context, Android.util.AttributeSet, int);} -keepclassmembers class * extends Android.app.Activity {# Keep the custom control class from being confused with public void * (Android.view.View);} -keepclassmembers enum * {# keep Enum enum class not confused public static **[] values (); public static * * VALUEOF (java.lang.String);} -keep class * Implements android.os.Parcelable {# keep Parcelable not be confused public static final Android.os.parcelable$creat or *;}
Android Code obfuscation