Android project code obfuscation and android project Obfuscation
The project root directory has two files:
1. project. properties
# This file is automatically generated by Android Tools.# Do not modify this file -- YOUR CHANGES WILL BE ERASED!## This file must be checked in Version Control Systems.## To customize properties used by the Ant build system edit# "ant.properties", and override values to adapt the script to your# project structure.## To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):sdk.dir=D:\Androidpmtoam\adt-bundle-windows-x86_64-20131030\sdkproguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt# Project target.target=android-19
2.proguard-project.txt
# To enable ProGuard in your project, edit project.properties# to define the proguard.config property as described in that file.## Add project specific ProGuard rules here.# By default, the flags in this file are appended to flags specified# in ${sdk.dir}/tools/proguard/proguard-android.txt# You can edit the include path and order by changing the ProGuard# include property in project.properties.## For more details, see# http://developer.android.com/guide/developing/tools/proguard.html# Add any project specific keep options here:# If your project uses WebView with JS, uncomment the following# and specify the fully qualified class name to the JavaScript interface# class:-keepclassmembers class fqcn.of.javascript.interface.for.webview { public *;}-optimizationpasses 5-dontusemixedcaseclassnames-dontskipnonpubliclibraryclasses-dontpreverify-verbose-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*-keep public class * extends android.app.Activity-dontwarn com.google.**-keep class com.google.** {*;}-dontwarn com.baidu.**-keep class com.baidu.** {*;}-dontwarn net.sqlcipher.**-keep class net.sqlcipher.** {*;}# Explicitly preserve all serialization members. The Serializable interface# is only a marker interface, so it wouldn't save them.-keepclassmembers class * implements java.io.Serializable { static final long serialVersionUID; private static final java.io.ObjectStreamField[] serialPersistentFields; private void writeObject(java.io.ObjectOutputStream); private void readObject(java.io.ObjectInputStream); java.lang.Object writeReplace(); java.lang.Object readResolve();}-keep public class * implements java.io.Serializable {*;}##---------------Begin: proguard configuration for Gson ----------# Gson uses generic type information stored in a class file when working with fields. Proguard# removes such information by default, so configure it to keep all of it.-keepattributes Signature# For using GSON @Expose annotation-keepattributes *Annotation*# Gson specific classes-keep class sun.misc.Unsafe { *; }-keep class com.dooioo.eal.entity.** { *; }# Application classes that will be serialized/deserialized over Gson-keep class com.google.gson.examples.android.model.** { *; }##---------------End: proguard configuration for Gson ----------
How to confuse Android programming code
Android's ADT in eclipse has changed the original mode. You can find these two files in the project file, which is generally in the project root directory.
The first file is the description file, and the second file is the configuration file.
To implement code obfuscation, You need to modify the second file. Open the second file as follows:
In the red line section, if you want to implement code obfuscation, You Need To comment out the following line.
Just remove the # sign before the second line of the red line.
I hope you will forgive me for any improper answers.
How to confuse code with android
If you do not use a third-party library or jar package, you only need to remove the # Before # proguard. config = xxxxxx in project. properties under the project directory. If there is a third-party jarpackage, add the configuration of the deployment to proguard-project.txt.