Reprint Please specify source: http://blog.csdn.net/l1028386804/article/details/47376377
Android itself can implement code obfuscation, Android integrated code obfuscation features, these features in the Android SDK tools have a Proguard directory, this directory is to provide the Andoid code obfuscation, We only need to make simple configuration in the Android project.
1. proguard.cfg file
After creating the Android project, there is a proguard.cfg file in the root directory of the Android project, which describes the confusing configuration of Android.
Specific 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 Androi D.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 *;}
2. project.properties file
This file is an environment configuration file for the entire project, and we only need to specify the configuration of the code mix in this file. Just add one line of configuration to your code
Proguard.config=proguard.cfg
Such as:
This makes the code confusing.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android--code obfuscation