最近做了專案寫的混淆加密程式碼,保留下來,下次備用

Aiven發表於2014-04-18
# 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 7
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
#遮蔽警告,指令碼中把這行註釋去掉
-ignorewarnings
-dontwarn  //dontwarn去掉警告


-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-dontwarn android.support.**
#混淆時應用侵入式過載
-overloadaggressively   
 
#確定統一的混淆類的成員名稱來增加混淆
-useuniqueclassmembernames  
#重用對映增加混淆
#-applymapping  com.envee.patientClient.activity.CheckNetActivity
 
# 元件並沒有混淆,因為系統需要通過清單(AndroidManifest.xml)檔案來查詢和執行應用程式。
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-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
-keep public class com.android.vending.licensing.ILicensingService

#保留R檔案
-keep class **.R$* {*;}

#如果系統中用到了註解對映機制,則需要保留
-keepattributes *Annotation*

#所有的native方法不能去混淆
-keepclasseswithmembernames class * {
    native <methods>;
}
 
#某些構造方法不能去混淆
-keepclasseswithmembers class * {
    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 {
   public void *(android.view.View);
}
# 列舉類不能去混淆.
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
#aidl檔案不被混淆
-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}


####   上面是所有混淆基本模板    ######
####   下面是專案自定義混淆      ######

#第三方jar包不能混淆
-libraryjars libs/alipay.jar
-libraryjars libs/android-support-v13.jar
-libraryjars libs/baidumapapi_v2_2_0.jar
-libraryjars libs/httpmime-4.1.3.jar
-libraryjars libs/jpinyin-1.0.jar
-libraryjars libs/locSDK_3.1.jar
-libraryjars libs/ShareSDK-Core-2.1.2.jar
-libraryjars libs/ShareSDK-QZone-2.1.2.jar
-libraryjars libs/ShareSDK-SinaWeibo-2.1.2.jar
-libraryjars libs/SocialSDK_QQZone_1.jar
-libraryjars libs/SocialSDK_QQZone_2.jar
-libraryjars libs/SocialSDK_tencentWB_1.jar
-libraryjars libs/SocialSDK_tencentWB_2.jar
-libraryjars libs/SocialSDK_WeiXin.jar
-libraryjars libs/umeng_sdk.jar
-libraryjars libs/umeng_social_sdk.jar
-libraryjars libs/UPPayAssistEx.jar
-libraryjars libs/UPPayPluginEx.jar
-libraryjars libs/zxing-core-2.2.jar
-keep class android.support.v4.**{*;}

#保留資料庫工具類
-keep class com.kklink.yuexia.db.**{*;}
-keep class com.kklink.database.**{*;}

#保留第三方程式碼
-keep class com.alipay.android.app.lib.**{*;}
-keep class com.google.zxing.client.android.**{*;}

#保留model實體
-keep class com.kklink.yuexia.model.**{*;}

相關文章