Android Obfuscation file proguard.cfg

Source: Internet
Author: User

1. Proguard Effect
Proguard the ability to obfuscate, compress, and optimize code by removing useless code, renaming the class name, method name, and property name in code to obscure names, similar to JavaScript obfuscation and compression.
Compression and optimization make the APK package smaller after compilation.
Confusion can ensure that the code is hard to read after being recompiled, preventing reverse engineering. This is one of the reasons why we need to Proguard before the app is released.

Reference: http://www.trinea.cn/android/proguard-use/

If packaged with the Eclipse Export command, it is within the <project_root>/proguard folder. It contains the following files:

Mapping.txt represents a comparison of the code before and after the confusion, this file is very important. If your code is confusing and generates a bug, the log hint is a confusing code, and if you want to locate the source code, you can reverse it by mapping.txt.
Dump.txt describes the internal structure of all class files within the APK
seeds.txt lists classes and members that are not confused
usage.txt lists code that is deleted in the source code that does not exist in the APK

-optimizationpasses 5
-dontusemixedcaseclassnames "does not produce a variety of class names when confused"
-dontskipnonpubliclibraryclasses "Specifies that non-public library classes are not ignored. 】
-dontskipnonpubliclibraryclassmembers
-dontpreverify "No pre-check"
-verbose
-dontoptimize
-optimizations!code/simplification/arithmetic,!field/*,!class/merging/* "Optimization"
-ignorewarnings

-dontwarn android.support.v4.**

-libraryjars Libs/gson-2.2.4.jar

-keep public class * extends Android.app.Activity "Do not confuse and remain as is"
-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 class * Implements java.io.serializable.** {*;} This is similar to one of the following, check what's different.

-keep class com.sina.weibo.**{*;}
-keep interface com.sina.weibo.**{*;}

-keepattributes *annotation*,*exceptions*,signature

-keepnames class * Implements Java.io.Serializable
-keepclassmembers class * Implements java.io.Serializable {*;}

Public protected <methods>; "All methods are not confused"
}
-keep public class com.asqw.android{
public void Start (java.lang.String); "No confusion with this method"
}

-keepclasseswithmembernames class * {"protects the name of a member of a specified class and class if all the specified class members are present (after the compression step)"

Native <methods>;
}

-keepclasseswithmembers class * {"Protects the members of the specified class and class, but the condition is that all specified classes and class members are to be present." 】
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 {"Protects members of a specified class if this class is protected they will be better protected"
public void * (Android.view.View);
}

-keepclassmembers enum * {
public static **[] values ();
public static * * VALUEOF (java.lang.String);
}

-keep class * Implements Android.os.Parcelable {"Protection of members of specified class files and classes"
public static final Android.os.parcelable$creator *;
}

Android Obfuscation file proguard.cfg

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.