Configuration of the Gradle
Proguard-rules.pro confusing configuration
# # #-----------Basic configuration-cannot be confused-------------keep public class * extends Android.app.activity-keep public class * extends Android.app.fragment-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 public class * extends Android.app.backup.backupagenthelper-keep public class * Extends ANDROID.PREFERENCE.PREFERENCE#SUPPORT.V4/V7 package does not confuse-keep class android.support.** {*;} -keep class android.support.v4.** {*;} -keep public class * extends Android.support.v4.**-keep interface android.support.v4.app.** {*;} -keep class android.support.v7.** {*;} -keep public class * extends Android.support.v7.**-keep interface android.support.v7.app.** {*;} -dontwarn android.support.** # Ignore warning # Keep Note Inheriting class does not confuse-keep class * extends Java.lang.annotation.Annotation {*;} #保持Serializable实现类不被混淆-keepnames class * Implements java.io.serializable# hold SerialiZable is not confused and the Enum class is not confused-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 ();} #保持枚举enum类不被混淆-keepclassmembers enum * {public static **[] values (), public static * * VALUEOF (java.lang.String); #自定义组件不被混淆-keep public class * extends Android.view.View {public <init> (android.content.Context); Public <init> (Android.content.Context, Android.util.AttributeSet); Public <init> (Android.content.Context, Android.util.AttributeSet, int.); public void set* (...);} #不混淆资源类-keepclassmembers class * *. r$* {public static <fields>;} # # #-----------Third party jar Package Library obfuscation configuration------------#ormlite混淆配置 #-libraryjars libs/ormlite-android-5.0.jar#-libraryjars Libs/ormlite-core-5.0.jar-donTwarn Com.j256.ormlite.**-keep class com.j256.ormlite.** {*;} -keep class com.envy15.cherry.base.orm.** {*;} #json-lib Obfuscation configuration #-libraryjars Libs/json-lib-2.4-jdk15.jar-dontwarn Net.sf.json.**-keep class net.sf.json.** {*;} #json-lib Association Package #-libraryjars Libs/commons-beanutils-1.8.3.jar-dontwarn Org.apache.commons.**-keep class org.apache.commons.** {*;} #universalimageloader图片加载框架不混淆-keep class com.nostra13.universalimageloader.** {*;} -dontwarn com.nostra13.universalimageloader.** #Gson相关的不混淆配置-keepattributes signature-keepattributes *Annotation*- Keep Class com.google.gson.** {*;} -dontwarn Com.google.gson.**-keep class com.envy15.cherry.fragment.crossover.model.** {*;} -dontwarn Com.envy15.cherry.fragment.crossover.model.**-keep class com.envy15.cherry.fragment.discover.model.** {* ; }-dontwarn Com.envy15.cherry.fragment.discover.model.**-keep class com.envy15.cherry.fragment.local.model.** {*;} -dontwarn Com.envy15.cherry.fragment.local.model.**-keep class Com.envy15.cherry.fragment.setting.model.** {*;} -dontwarn com.envy15.cherry.fragment.setting.model.** #prt-lib dropdown refresh frame does not confuse-keep class in.srain.cube.views.ptr.** {*;} -dontwarn in.srain.cube.views.ptr.** #PullToRefreshLibrary下拉刷新框架不混淆-keep class com.handmark.pulltorefresh.library. ** { *; } -dontwarn com.handmark.pulltorefresh.library.** #参考: # http://blog.csdn.net/zuiwuyuan/article/details/48552701# http://blog.csdn.net/fengyuzhengfan/article/details/43876197# http://blog.isming.me/2014/05/31/use-proguard/# http://hanhailong.com/2015/12/28/Android%E8%BF%9B%E9%98%B6%E4%B9%8BProGuard%E4%BB%A3%E7%A0%81%E6%B7%B7%E6%B7% 86/# Thinking about confusion: # https://www.zhihu.com/question/37446729# Extension: Resource file obfuscation # http://blog.csdn.net/Fancy_xty/article/details/ 51202866# Code Obfuscation Rule # Specifies the compression level of the code #-optimizationpasses if the case is mixed #-dontusemixedcaseclassnames# whether the third party is confused with jar#- dontskipnonpubliclibraryclasses# whether to do pre-check #-dontpreverify# confusion when the algorithm used to log #-verbose# confusion is #-optimizations!code/ Simplification/arithmetic,!field/*,!class/merging/*#-keep public class * extends AndroidOid.app.Activity # Keep What classes are not confused #-keep public class * extends Android.app.Application # Keep What classes are not confused #-keep public class * extends Android.app.Service # Keep What classes are not confused #- Keep public class * extends Android.content.BroadcastReceiver # Keep What classes are not confused #-keep public class * extends an Droid.content.ContentProvider # Keep What classes are not confused #-keep public class * extends Android.app.backup.BackupAgentHe Lper # 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 C Lass * {# Keep Native method not to be confused # native <methods>;#}##-keepclasseswithmembe Rs class * {# Keep custom control classes from being confused # public <init> (Android.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 not confused # public void * (Android.view.View); #}##-keepclassmembers enum * {# keep enum enum Class is not confused # public static **[] VALUES (), # public static * * VALUEOF (java.lang.String); #}##-keep class * Implements Androi d.os.parcelable {# keep Parcelable not confused # public static final Android.os.parcelable$creator *;#}#-keep class MyClass; # Keep your defined classes from being confused
Package release
* Crash Log record * Reference: * http://blog.csdn.net/u012333411/article/details/49019415 * http://blog.csdn.net/ wangyuexing_blog/article/details/39009069
Android code obfuscation and packaging