编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

最近做了项目写的混淆加密代码,保留下来,下次备用

wxchong 2024-06-21 14:17:13 开源技术 13 ℃ 0 评论

# 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.**{*;}

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表