diff --git a/proguard-project.txt b/proguard-project.txt index e6db6e2..2eb59b6 100644 --- a/proguard-project.txt +++ b/proguard-project.txt @@ -29,13 +29,14 @@ -ignorewarnings #是否使用大小写混合 -dontusemixedcaseclassnames -#是否混淆第三方jar 如果应用程序引入的有jar包,并且想混淆jar包里面的class --dontskipnonpubliclibraryclasses +#是否混淆第三方jar 如果应用程序引入的有jar包,并且想混淆jar包里面的class(最好不要混淆第三方的jar) +#-dontskipnonpubliclibraryclasses #指定代码的压缩级别0 ~ 7 -optimizationpasses 5 #混淆时是否记录日志 -verbose +############################################Android默认混淆配置(开始)############################################# # Optimization is turned off by default. Dex does not like code run # through the ProGuard optimize and preverify steps (and performs some # of these optimizations on its own). @@ -86,9 +87,10 @@ # Don't warn about those in case this app is linking against an older # platform version. We know about them, and they are safe. -dontwarn android.support.** +############################################Android默认混淆配置(结束)############################################# -#一些基本的类不进行混淆 +############################################Android四大组件/基本类-组件/数据模型混淆配置(开始)############################################# -keep public class * extends android.app.Activity -keep public class * extends android.app.SherlockActivity -keep public class * extends android.app.Fragment @@ -99,20 +101,19 @@ -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference +############################################Android四大组件/基本类-组件/数据模型混淆配置(结束)############################################# -#Application不进行混淆 --keep public class * com.zftlive.android.GlobalApplication -#过滤R文件的混淆 --keep public class com.zftlive.android.library.R --keep class com.zftlive.android.library.R$* { *; } --keepclassmembers class com.zftlive.android.library.R$* { - public static ; -} +############################################Application/R/V4辅助包混淆配置(开始)############################################# +#Application不进行混淆,拷贝时注意记得修改成自己APP的包 +-keep public class com.zftlive.android.GlobalApplication + +#当前工程的R文件不进行混淆,必须保留 -keep public class com.zftlive.android.R -keep class com.zftlive.android.R$* { *; } --keepclassmembers class com.zftlive.android.library.R$* { - public static ; +-keepclassmembers class com.zftlive.android.R$* { + ; + ; } #android辅助包 @@ -120,71 +121,171 @@ -dontwarn android.support.v4.** -keep class android.support.v4.** -keep interface android.support.v4.app.** {*;} +############################################Application/R/V4辅助包混淆配置(结束)############################################# + +############################################zftlive-xxx或者Ajava-Android-lib-Vxxx.jar(开始)############################################# +#类库R文件不能混淆,必须保留 +-keep public class com.zftlive.android.library.R +-keep class com.zftlive.android.library.R$* { *; } +-keepclassmembers class com.zftlive.android.library.R$* { + ; + ; +} #网络检测类(防止找不到构造方法) -keep public class com.zftlive.android.library.tools.ToolNetwork -keepclassmembers class com.zftlive.android.library.tools.ToolNetwork{ public *; } - #分享工具类(防止找不到构造方法) -keep public class com.zftlive.android.library.tools.ToolShareSDK -keepclassmembers class com.zftlive.android.library.tools.ToolShareSDK{ public *; } - #数据库操作类(防止找不到构造方法) -keep public class com.zftlive.android.library.tools.ToolDatabase -keepclassmembers class com.zftlive.android.library.tools.ToolDatabase{ public *; } +#保留所有序列化的实体类名、字段、方法,使用了GSON或者数据库映射 +-keep public class * extends com.zftlive.android.library.base.BaseEntity +-keepclasseswithmembers class * extends com.zftlive.android.library.base.BaseEntity{ + ; + ; +} +#自定义控件保留,防止找不到类(使用包名通配和类继承关系) +-keep public class * extends com.zftlive.android.library.base.BaseView +-keepclasseswithmembers class * extends com.zftlive.android.library.base.BaseView{ + ; + ; +} +-dontwarn com.zftlive.android.library.widget.** +-keep class com.zftlive.android.library.widget.** {*;} +#集成的第三方开源类库不混淆 +-dontwarn com.zftlive.android.library.third.** +-keep class com.zftlive.android.library.third.** {*;} -####################zftlive-core-1.0.jar(开始)######################### -#-libraryjars libs/ajavaandroidlib.jar --keep class com.zftlive.android.library.** {*;} - -#忽略实体、四大组件 -#-keep class com.zftlive.android.library.model.** {*;} -#-keep class com.zftlive.android.library.entity.** {*;} -#-keep class com.zftlive.android.library.** {*;} -#-keep class com.zftlive.android.library.service.** {*;} -#-keep class com.zftlive.android.library.widget.** {*;} -####################zftlive-core-1.0.jar(结束)######################### +############################################zftlive-xxx或者Ajava-Android-lib-Vxxx.jar(结束)############################################# -####################网络通信相关jar(开始)########################### -#-libraryjars libs/android-async-http-1.4.5.jar -#-dontwarn com.loopj.android.http.** -#-keep class com.loopj.android.http.** {*;} -####################网络通信相关jar(结束)############################ +############################################第三方jar混淆保留配置(开始)############################################# +####################信鸽推送(开始)##################### +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep class com.tencent.android.tpush.** {*;} +-keep class com.tencent.mid.** {*;} +####################信鸽推送(结束)##################### +####################百度地图、定位、LBS相关jar(开始)##################### +-dontwarn com.baidu.** +-keep class com.baidu.** {*;} -####################ActionBarSherlock相关jar(开始)#################### -#-dontwarn com.actionbarsherlock.** -#-keep class com.actionbarsherlock.** {*;} -####################ActionBarSherlock相关jar(结束)#################### +-dontwarn vi.com.gdi.bgl.android.java.** +-keep class vi.com.gdi.bgl.android.java.** {*;} +####################百度地图、定位、LBS相关jar(结束)##################### +####################谷歌开源项目相关zxing/gson/volley/RoboGuice2(开始)##################### +#谷歌zxing二维码相关jar +-dontwarn com.google.zxing.** +-keep class com.google.zxing.** {*;} + +#谷歌GSON +-keepattributes Signature +-keepattributes *Annotation* +-keep class sun.misc.Unsafe { *; } +-keep class com.google.gson.stream.** { *; } + +#谷歌Volley +-dontwarn com.android.http.** +-keep class com.android.http.** {*;} +-dontwarn com.android.volley.** +-keep class com.android.volley.** {*;} + +#谷歌 RoboGuice2框架相关jar +-dontwarn com.google.inject.** +-keep class com.google.inject.** {*;} +-dontwarn roboguice.** +-keep class roboguice.** {*;} +-dontwarn javax.annotation.** +-keep class javax.annotation.** {*;} +-dontwarn javax.inject.** +-keep class javax.inject.** {*;} +####################谷歌开源项目相关zxing/gson/volley/RoboGuice2(结束)##################### + +####################ShareSdk相关jar(开始)########################### +#mob工具类/Log相关 +-dontwarn com.mob.** +-keep class com.mob.** {*;} + +#sharesdk社会化组件 +-dontwarn cn.sharesdk.** +-keep class cn.sharesdk.** {*;} + +#发送短信验证码jar +-libraryjars libs/SMSSDK-1.2.2.jar +-dontwarn cn.smssdk.** +-keep class cn.smssdk.** {*;} + +-dontwarn a.a.a.a.** +-keep class a.a.a.a.** {*;} +####################ShareSdk相关jar(结束)########################### + +####################环信即时通讯IM相关jar(开始)########################### +-keep class org.xmlpull.** {*;} +-keep class com.baidu.** {*;} +-keep public class * extends com.umeng.** +-keep class com.umeng.** { *; } +-keep class com.squareup.picasso.* {*;} +-keep class com.easemob.* {*;} +-keep class com.easemob.chat.** {*;} +-keep class org.jivesoftware.** {*;} +-keep class org.apache.** {*;} +#另外,demo中发送表情的时候使用到反射,需要keep SmileUtils,注意前面的包名, +#不要SmileUtils复制到自己的项目下keep的时候还是写的demo里的包名 +-keep class com.easemob.chatuidemo.utils.SmileUtils {*;} +#2.0.9后加入语音通话功能,如需使用此功能的api,加入以下keep +-keep class net.java.sip.** {*;} +-keep class org.webrtc.voiceengine.** {*;} +-keep class org.bitlet.** {*;} +-keep class org.slf4j.** {*;} +-keep class ch.imvs.** {*;} +####################环信即时通讯IM相关jar(结束)########################### + +####################SOAP访问第三方jar ksoap2-android.jar(开始)##################### +-dontwarn org.kobjects.** +-keep class org.kobjects.** {*;} +-dontwarn org.ksoap2.** +-keep class org.ksoap2.** {*;} +-dontwarn org.kxml2.** +-keep class org.kxml2.** {*;} +-dontwarn org.xmlpull.** +-keep class org.xmlpull.** {*;} +####################SOAP访问第三方jar ksoap2-android.jar(结束)##################### + +####################nineoldandroids(开始)##################### +-dontwarn com.nineoldandroids.** +-keep class com.nineoldandroids.** {*;} +####################nineoldandroids(结束)##################### + +####################achartengine(开始)##################### +-dontwarn org.achartengine.** +-keep class org.achartengine.** {*;} +####################achartengine(结束)##################### ####################滑动菜单SlidingMenu相关jar(开始)################## #-dontwarn com.jeremyfeinstein.slidingmenu.lib.** #-keep class com.jeremyfeinstein.slidingmenu.lib.** {*;} ####################滑动菜单SlidingMenu相关jar(结束)################### +####################ActionBarSherlock相关jar(开始)#################### +#-dontwarn com.actionbarsherlock.** +#-keep class com.actionbarsherlock.** {*;} +####################ActionBarSherlock相关jar(结束)#################### -####################ShareSdk相关jar(开始)########################### -#-libraryjars libs/sharesdk-core-2.3.11.jar -#-libraryjars libs/sharesdk-sinaweibo-2.3.11.jar -#-libraryjars libs/sharesdk-tencentweibo-2.3.11.jar -#-libraryjars libs/sharesdk-wechat-2.3.11.jar -#-libraryjars libs/sharesdk-wechat-core-2.3.11.jar -#-dontwarn cn.sharesdk.** -#-keep class cn.sharesdk.** {*;} - -#发送短信验证码jar -#-dontwarn cn.smssdk.** -#-keep class cn.smssdk.** {*;} -####################ShareSdk相关jar(结束)########################### - +####################图片异步加载universal-image-loader(开始)##################### +#-dontwarn com.nostra13.universalimageloader.** +#-keep class com.nostra13.universalimageloader.** {*;} +####################图片异步加载universal-image-loader(结束)##################### ####################ormlite数据库操作相关jar(开始)##################### #-libraryjars libs/ormlite-android-4.48.jar @@ -193,59 +294,11 @@ #-keep class com.j256.ormlite.** {*;} ####################ormlite数据库操作相关jar(结束)##################### - -####################谷歌zxing二维码相关jar(开始)##################### -#-dontwarn com.google.zxing.** -#-keep class com.google.zxing.** {*;} -####################谷歌zxing二维码相关jar(结束)##################### - - -####################谷歌 RoboGuice2框架相关jar(开始)##################### -#-dontwarn com.google.inject.** -#-keep class com.google.inject.** {*;} -#-dontwarn roboguice.** -#-keep class roboguice.** {*;} -#-dontwarn javax.annotation.** -#-keep class javax.annotation.** {*;} -#-dontwarn javax.inject.** -#-keep class javax.inject.** {*;} -####################谷歌 RoboGuice2框架相关jar(结束)##################### - - -####################表单验证插件 android-validation-komensky0.9.3.jar(开始)##################### -#-dontwarn eu.inmite.android.lib.** -#-keep class eu.inmite.android.lib.** {*;} -####################表单验证插件 android-validation-komensky0.9.3.jar(结束)##################### - - -####################百度地图、定位相关jar(开始)##################### -#-dontwarn com.baidu.** -#-keep class com.baidu.** {*;} -####################百度地图、定位相关jar(结束)##################### - - -####################图片异步加载universal-image-loader-1.8.4.jar(开始)##################### -#-dontwarn com.nostra13.universalimageloader.** -#-keep class com.nostra13.universalimageloader.** {*;} -####################图片异步加载universal-image-loader-1.8.4.jar(结束)##################### - - -####################SOAP访问第三方jar ksoap2-android.jar(开始)##################### -#-dontwarn org.kobjects.** -#-keep class org.kobjects.** {*;} -#-dontwarn org.ksoap2.** -#-keep class org.ksoap2.** {*;} -#-dontwarn org.kxml2.** -#-keep class org.kxml2.** {*;} -#-dontwarn org.xmlpull.** -#-keep class org.xmlpull.** {*;} -####################SOAP访问第三方jar ksoap2-android.jar(结束)##################### - - -####################XStream操作xml与Bean之间转换jar(开始)##################### -#-dontwarn com.thoughtworks.xstream.** -#-keep class com.thoughtworks.xstream.** {*;} -####################XStream操作xml与Bean之间转换jar(结束)##################### +####################网络通信相关jar(开始)########################### +#-libraryjars libs/android-async-http-1.4.5.jar +#-dontwarn com.loopj.android.http.** +#-keep class com.loopj.android.http.** {*;} +####################网络通信相关jar(结束)############################ ####################asmack操作相关jar(开始)##################### #-dontwarn com.kenai.jbosh.** @@ -273,9 +326,14 @@ #-keep class org.apache.poi.** {*;} ####################poi辅助包(结束)##################### -####################信鸽推送(开始)##################### --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep class com.tencent.android.tpush.** {*;} --keep class com.tencent.mid.** {*;} -####################信鸽推送(结束)##################### \ No newline at end of file +####################表单验证插件 android-validation-komensky0.9.3.jar(开始)##################### +#-dontwarn eu.inmite.android.lib.** +#-keep class eu.inmite.android.lib.** {*;} +####################表单验证插件 android-validation-komensky0.9.3.jar(结束)##################### + +####################XStream操作xml与Bean之间转换jar(开始)##################### +#-dontwarn com.thoughtworks.xstream.** +#-keep class com.thoughtworks.xstream.** {*;} +####################XStream操作xml与Bean之间转换jar(结束)##################### + +############################################第三方jar混淆保留配置(结束)############################################# \ No newline at end of file diff --git a/project.properties b/project.properties index 351e57c..4b99145 100644 --- a/project.properties +++ b/project.properties @@ -10,6 +10,14 @@ # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt +#\u6df7\u6dc6\u540e\u5728\u5de5\u4f5c\u533a\u7684\u9879\u76ee\u6587\u4ef6\u5939\u4e0b\u4f1a\u751f\u6210\u4e00\u4e2aproguard\u6587\u4ef6\uff0c\u5176\u4e2d\uff1a +#dump.txt \u63cf\u8ff0\u4e86apk\u6587\u4ef6\u4e2d\u6240\u6709\u7c7b\u7684\u7ed3\u6784\u3002 +#mapping.txt \u5217\u51fa\u4e86\u6e90\u7801\u4e0e\u6df7\u6dc6\u540e\u7684\uff0c\u7c7b\uff0c\u65b9\u6cd5\uff0c\u5b57\u6bb5\u7684\u540d\u79f0\u6620\u5c04\u3002\u5f53\u4f60\u4ece\u53d1\u5e03\u9879\u76ee\u4e2d\u6536\u5230Bug\u62a5\u544a\u65f6\uff08\u5927\u4f53\u610f\u601d\u5e94\u8be5\u662f\uff0c\u7528\u624b\u673a\u8fde\u63a5\u5230Eclipse\u8c03\u8bd5\u6df7\u6dc6\u540e\u7684\u8f6f\u4ef6\u65f6\uff0c \u4e3a\u4e86\u6b63\u786e\u7684\u8f93\u51fa\u65e5\u5fd7\u4f1a\u7528\u5230\u8fd9\u4e2a\u6620\u5c04\u6587\u4ef6\uff09\uff0c\u8fd9\u4e2a\u6587\u4ef6\u65f6\u5f88\u91cd\u8981\u7684\u3002\u56e0\u4e3a\u9700\u8981\u7ffb\u8bd1\u6df7\u6dc6\u5806\u6808\u8ddf\u8e2a\u540e\u7684\u7c7b\u540d\u3001\u65b9\u6cd5\u3001\u5b57\u6bb5\u7684\u540d\u79f0\uff08\u8fd9\u4e9b\u662f\u6e90\u7801\u4e2d\u771f\u6b63\u7684\u540d\u79f0\uff09\u3002 +#seeds.txt \u5217\u51fa\u6ca1\u6709\u6df7\u6dc6\u7684\u7c7b\u548c\u6210\u5458\u3002 +#usage.txt \u5217\u51fa\u4e86\u4eceapk\u6587\u4ef6\u4e2d\u5265\u79bb\u7684\u4ee3\u7801 +proguard.config=proguard-project.txt +#dex.force.jumbo=true + # Project target. target=android-19 dex.force.jumbo=true