From 03a101d8f73bd86a95c789805834cc2296e492c9 Mon Sep 17 00:00:00 2001 From: zu Date: Wed, 29 Nov 2023 10:02:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B5=84=E6=BA=90=E6=B7=B7?= =?UTF-8?q?=E6=B7=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/aab-res-guard-mapping.txt | 0 app/build.gradle | 34 ++++++++++++++++++++++------------ app/xml-class-mapping.txt | 2 ++ build.gradle | 3 +++ 4 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 app/aab-res-guard-mapping.txt create mode 100644 app/xml-class-mapping.txt diff --git a/app/aab-res-guard-mapping.txt b/app/aab-res-guard-mapping.txt new file mode 100644 index 000000000..e69de29bb diff --git a/app/build.gradle b/app/build.gradle index 6629e5a3c..d3bd896e6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'kotlin-android' apply plugin: 'com.tencent.vasdolly' apply from: '../project.gradle' +apply plugin: "com.bytedance.android.aabResGuard" apply plugin: "xml-class-guard" android { @@ -317,21 +318,30 @@ channel { lowMemory = false } +aabResGuard { + mappingFile = file("aab-res-guard-mapping.txt").toPath() // Mapping file used for incremental obfuscation + whiteList = [ // White list rules + "*.R.raw.*", + "*.R.drawable.icon" + ] + obfuscatedBundleFileName = "duplicated-app.aab" // Obfuscated file name, must end with '.aab' + mergeDuplicatedRes = true // Whether to allow the merge of duplicate resources + enableFilterFiles = true // Whether to allow filter files + filterList = [ // file filter rules + "*/arm64-v8a/*", + "META-INF/*" + ] + + enableFilterStrings = false // switch of filter strings + unusedStringPath = file("unused.txt").toPath() // strings will be filtered in this file + languageWhiteList = ["en", "zh"] // keep en,en-xx,zh,zh-xx etc. remove others. +} + //以下均为非必须 xmlClassGuard { - /* - * 是否查找约束布局的constraint_referenced_ids属性的值,并添加到AabResGuard的白名单中, - * 是的话,要求你在XmlClassGuard前依赖AabResGuard插件,默认false - */ - findAabConstraintReferencedIds = false - - /* - * 是否查找约束布局的constraint_referenced_ids属性的值,并添加到AndResGuard的白名单中, - * 是的话,要求你在XmlClassGuard前依赖AndResGuard插件,默认false - */ - findAndConstraintReferencedIds = false + findAabConstraintReferencedIds = true //用于增量混淆的 mapping 文件 mappingFile = file("xml-class-mapping.txt") //更改manifest文件的package属性,即包名 - packageChange = ["com.chwl.app": "com.chwl.app"] + packageChange = ["com.chwl.app": "co.ch.a"] } \ No newline at end of file diff --git a/app/xml-class-mapping.txt b/app/xml-class-mapping.txt new file mode 100644 index 000000000..6d6425450 --- /dev/null +++ b/app/xml-class-mapping.txt @@ -0,0 +1,2 @@ +class mapping: + baaabaffdafcee.BaseZoomableImageView -> q.UII \ No newline at end of file diff --git a/build.gradle b/build.gradle index 158e8ea1c..472b17e16 100644 --- a/build.gradle +++ b/build.gradle @@ -10,10 +10,12 @@ buildscript { repositories { mavenCentral() + jcenter() google() maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://jitpack.io' } maven { url 'https://repo1.maven.org/maven2/' } + maven { url 'https://raw.githubusercontent.com/martinloren/AabResGuard/mvn-repo' } } dependencies { @@ -26,6 +28,7 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.tencent.vasdolly:plugin:3.0.3' + classpath "com.bytedance.android:aabresguard-plugin:0.1.10" classpath "com.github.liujingxing:XmlClassGuard:1.2.6" } }