buildscript {
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
//资源混淆
classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.21'
}
}
链接https://github.com/shwenzhang/AndResGuard
apply from: 'res_build.gradle'
apply plugin: 'AndResGuard'
andResGuard {
// mappingFile = file("./resource_mapping.txt")
mappingFile = null
use7zip = true
useSign = true
// 打开这个开关,会keep住所有资源的原始路径,只混淆资源的名字
keepRoot = false
// 设置这个值,会把arsc name列混淆成相同的名字,减少string常量池的大小
fixedResName = "arg"
// 打开这个开关会合并所有哈希值相同的资源,但请不要过度依赖这个功能去除去冗余资源
mergeDuplicatedRes = true
whiteList = [
// for your icon
"R.drawable.icon",
// for fabric
"R.string.com.crashlytics.*",
// for google-services
"R.string.google_app_id",
"R.string.gcm_defaultSenderId",
"R.string.default_web_client_id",
"R.string.ga_trackingId",
"R.string.firebase_database_url",
"R.string.google_api_key",
"R.string.google_crash_reporting_api_key"
]
compressFilePattern = [
"*.png",
"*.jpg",
"*.jpeg",
"*.gif",
]
sevenzip {
artifact = 'com.tencent.mm:SevenZip:1.2.21'
//path = "/usr/local/bin/7za"
}
/**
* 可选: 如果不设置则会默认覆盖assemble输出的apk
**/
// finalApkBackupPath = "${project.rootDir}/final.apk"
/**
* 可选: 指定v1签名时生成jar文件的摘要算法
* 默认值为“SHA-1”
**/
// digestalg = "SHA-256"
}
getui(个推)
"R.drawable.push",
"R.drawable.push_small",
"R.layout.getui_notification"
JPush(极光推送)
"R.drawable.jpush_notification_icon"
GrowingIO
"R.string.growingio_project_id",
"R.string.growingio_url_scheme",
"R.string.growingio_channel"
Firebase
firStore
R.string.project_id
Huawei push
"R.string.hms_*",
"R.string.connect_server_fail_prompt_toast",
"R.string.getting_message_fail_prompt_toast",
"R.string.no_available_network_prompt_toast",
"R.string.third_app_*",
"R.string.upsdk_*",
"R.style.upsdkDlDialog",
"R.style.AppTheme",
"R.style.AppBaseTheme",
"R.dimen.upsdk_dialog_*",
"R.color.upsdk_*",
"R.layout.upsdk_*",
"R.drawable.upsdk_*",
"R.drawable.hms_*",
"R.layout.hms_*",
"R.id.hms_*"
Firebase Crashlytics
"R.bool.com.crashlytics.useFirebaseAppId",
"R.string.com.crashlytics.useFirebaseAppId",
"R.string.google_app_id",
"R.bool.com.crashlytics.CollectDeviceIdentifiers",
"R.string.com.crashlytics.CollectDeviceIdentifiers",
"R.bool.com.crashlytics.CollectUserIdentifiers",
"R.string.com.crashlytics.CollectUserIdentifiers",
"R.string.com.crashlytics.ApiEndpoint",
"R.string.io.fabric.android.build_id",
"R.string.com.crashlytics.android.build_id",
"R.bool.com.crashlytics.RequireBuildId",
"R.string.com.crashlytics.RequireBuildId",
"R.bool.com.crashlytics.CollectCustomLogs",
"R.string.com.crashlytics.CollectCustomLogs",
"R.bool.com.crashlytics.Trace",
"R.string.com.crashlytics.Trace",
"R.string.com.crashlytics.CollectCustomKeys"
shareSDK
"R.id.ssdk*",
"R.string.mobcommon*",
"R.string.ssdk*",
"R.string.mobdemo*",
"R.drawable.mobcommon*",
"R.drawable.ssdk*",
"R.layout.mob*",
"R.style.mobcommon*",
穿山甲广告SDK
"R.string.tt_*",
"R.integer.tt_*",
"R.layout.tt_*",
"R.drawable.tt_*",
"R.style.tt_*",
"R.dimen.tt_*",
"R.anim.tt_*",
"R.color.tt_*",
"R.id.tt_*"
file-》打开task
右侧task目录下运行res…