Android Proguard

傅经业
2023-12-01
  1 # To enable ProGuard in your project, edit project.properties
  2 # to define the proguard.config property as described in that file.
  3 #
  4 # Add project specific ProGuard rules here.
  5 # By default, the flags in this file are appended to flags specified
  6 # in ${sdk.dir}/tools/proguard/proguard-android.txt
  7 # You can edit the include path and order by changing the ProGuard
  8 # include property in project.properties.
  9 #
 10 # For more details, see
 11 #   http://developer.android.com/guide/developing/tools/proguard.html
 12 
 13 # Add any project specific keep options here:
 14 
 15 # If your project uses WebView with JS, uncomment the following
 16 # and specify the fully qualified class name to the JavaScript interface
 17 # class:
 18 #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
 19 #   public *;
 20 #}
 21 
 22 #混淆的压缩比率 0 ~ 7 
 23 -optimizationpasses 5
 24 #Aa aA 
 25 -dontusemixedcaseclassnames
 26 #混淆jar包里面的class
 27 -dontskipnonpubliclibraryclasses
 28 -dontpreverify
 29 #混淆后生产映射文件 map 类名->转化后类名的映射
 30 -verbose
 31 #混淆采用的算法.
 32 -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
 33 
 34 -keepattributes *Annotation*
 35 -keepattributes Signature
 36 
 37 #百度地图
 38 -libraryjars ../../workspace/OmengLibrary/libs/armeabi/libBaiduMapSDK_v3_2_0_15.so
 39 -libraryjars ../../workspace/OmengLibrary/libs/armeabi/liblocSDK4d.so
 40 -libraryjars ../../workspace/OmengLibrary/libs/BaiduLBS_Android.jar
 41 -keep class com.baidu.** { *; }
 42 -keep class vi.com.gdi.bgl.android.**{*;}
 43 
 44 #个推
 45 -libraryjars ../../workspace/OmengLibrary/libs/armeabi/libgetuiext.so
 46 -libraryjars ../../workspace/OmengLibrary/libs/GetuiExt-2.0.3.jar
 47 -libraryjars ../../workspace/OmengLibrary/libs/GetuiSdk2.4.1.0.jar
 48 -dontwarn com.igexin.**
 49 -keep class com.igexin.**{*;}
 50 
 51 #微信
 52 -libraryjars ../../workspace/OmengLibrary/libs/libammsdk_pay.jar
 53 
 54 #友盟
 55 -libraryjars ../../workspace/OmengLibrary/libs/umeng-analytics-v5.4.2.jar
 56 -keepclassmembers class * {
 57    public <init>(org.json.JSONObject);
 58 }
 59 -keep class com.umeng.** { *; }  
 60 -keep class com.umeng.analytics.** { *; }  
 61 -keep class com.umeng.common.** { *; }  
 62 -keep class com.umeng.newxp.** { *; }  
 63 
 64 #piyin4j
 65 #-libraryjars ../../workspace/OmengLibrary/libs/pinyin4j-2.5.0.jar
 66 -dontwarn demo.Pinyin4jAppletDemo*
 67 
 68 #android-support-v4
 69 -libraryjars  ../../workspace/OmengLibrary/libs/android-support-v4.jar
 70 
 71 -keep public class * extends android.app.Fragment  
 72 -keep public class * extends android.app.Activity
 73 -keep public class * extends android.app.Application
 74 -keep public class * extends android.app.Service
 75 -keep public class * extends android.content.BroadcastReceiver
 76 -keep public class * extends android.content.ContentProvider
 77 -keep public class * extends android.app.backup.BackupAgentHelper
 78 -keep public class * extends android.preference.Preference
 79 -keep public class * extends android.support.v4.**
 80 -keep public class com.android.vending.licensing.ILicensingService
 81 
 82 -keep class com.google.gson.stream.** { *; }
 83 -keep class com.google.gson.examples.android.model.** { *; }
 84 -keep class com.uuhelper.Application.** { *; }
 85 -keep class net.sourceforge.zbar.** { *; }
 86 -keep class com.google.android.gms.** { *; } 
 87 
 88 #实体类
 89 -keep class com.robinxdroid.bean.** { *; }
 90 
 91 -keep class com.android.vending.licensing.ILicensingService
 92 -keep class android.support.v4.** { *; }  
 93 -keep class org.apache.commons.net.** { *; }  
 94 -keep class com.tencent.** { *; }  
 95  
 96 -dontwarn android.support.v4.**  
 97 -dontwarn org.apache.commons.net.** 
 98 -dontwarn com.tencent.**  
 99 
100 #Native
101 -keepclasseswithmembernames class * {
102     native <methods>;
103 }
104 
105 #构造方法
106 -keepclasseswithmembernames class * {
107     public <init>(android.content.Context, android.util.AttributeSet);
108 }
109 
110 -keepclasseswithmembernames class * {
111     public <init>(android.content.Context, android.util.AttributeSet, int);
112 }
113 
114 -keepclassmembers class * extends android.app.Activity {
115    public void *(android.view.View);
116 }
117 
118 #枚举
119 -keepclassmembers enum * {
120     public static **[] values();
121     public static ** valueOf(java.lang.String);
122 }
123 #AIDL
124 -keep class * implements android.os.Parcelable {
125   public static final android.os.Parcelable$Creator *;
126 }
127 
128 -keepclasseswithmembers class * {
129     public <init>(android.content.Context);
130 }
131 
132 -dontshrink
133 -dontoptimize
134 -dontwarn com.google.android.maps.**
135 -dontwarn android.webkit.WebView
136 -dontwarn com.umeng.**
137 -dontwarn com.tencent.weibo.sdk.**
138 -dontwarn com.facebook.**
139 
140 -keep enum com.facebook.**
141 -keepattributes Exceptions,InnerClasses,Signature
142 -keepattributes *Annotation*
143 -keepattributes SourceFile,LineNumberTable
144 
145 -keep public interface com.facebook.**
146 -keep public interface com.tencent.**
147 -keep public interface com.umeng.socialize.**
148 -keep public interface com.umeng.socialize.sensor.**
149 -keep public interface com.umeng.scrshot.**
150 
151 -keep public class com.umeng.socialize.* {*;}
152 -keep public class javax.**
153 -keep public class android.webkit.**
154 
155 -keep class com.facebook.**
156 -keep class com.umeng.scrshot.**
157 -keep public class com.tencent.** {*;}
158 -keep class com.umeng.socialize.sensor.**
159 
160 -keep class com.tencent.mm.sdk.openapi.WXMediaMessage {*;}
161 
162 -keep class com.tencent.mm.sdk.openapi.** implements com.tencent.mm.sdk.openapi.WXMediaMessage$IMediaObject {*;}
163 
164 #-keep class im.yixin.sdk.api.YXMessage {*;}
165 #-keep class im.yixin.sdk.api.** implements im.yixin.sdk.api.YXMessage$YXMessageData{*;}
166 
167 -keep public class [Your package name].R$*{
168    public static final int *;
169 }
170 
171 #-keep class **.R$* {   *;   }

混淆示例

转载于:https://www.cnblogs.com/robinxdroid/p/4773907.html

 类似资料:

相关阅读

相关文章

相关问答