From 620e5e085e851fac1a0f18ce7b7891ac8acd7a9d Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Sun, 29 May 2022 13:08:00 +0800 Subject: [PATCH] update gradle script Signed-off-by: fengyuecanzhu <1021300691@qq.com> --- app/build.gradle | 2 +- app/src/test/java/Test.java | 3 +- app/version_code.properties | 2 +- dynamic/build.gradle | 29 +++++++++++++++++++ dynamic/proguard-rules.pro | 6 +++- .../fycz/dynamic/ExampleInstrumentedTest.kt | 7 +++-- .../main/java/xyz/fycz/dynamic/AppLoadImpl.kt | 3 +- 7 files changed, 43 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index fe77568..05dec11 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ def getVersionC() { def name = "风月读书" def versionC = getVersionC() -def versionN = versionC.toString().join(".") +def versionN = versionC.toString().join("", ".") // 读取keystore.properties def keyProps = new Properties() diff --git a/app/src/test/java/Test.java b/app/src/test/java/Test.java index 65fcd2a..135d55c 100644 --- a/app/src/test/java/Test.java +++ b/app/src/test/java/Test.java @@ -21,6 +21,7 @@ import org.seimicrawler.xpath.JXDocument; import java.io.File; import java.io.UnsupportedEncodingException; import java.util.ArrayList; +import java.util.Base64; import java.util.List; import xyz.fycz.myreader.model.sourceAnalyzer.BaseAnalyzer; @@ -135,7 +136,7 @@ public class Test { @org.junit.Test public void md5(){ - File file = new File("D:\\Java\\AndroidSdk\\build-tools\\29.0.3\\dynamic_v1.0.5.dex"); + File file = new File("D:\\Java\\AndroidSdk\\build-tools\\29.0.3\\dynamic_v1.0.6.dex"); System.out.println(MD5Utils.INSTANCE.getFileMD5s(file, 32)); } } diff --git a/app/version_code.properties b/app/version_code.properties index 64df2c5..5083a27 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -18,4 +18,4 @@ #Fri Jun 18 21:45:31 CST 2021 VERSION_CODE=246 -CREATE_RELEASE=true \ No newline at end of file +CREATE_RELEASE=false \ No newline at end of file diff --git a/dynamic/build.gradle b/dynamic/build.gradle index adbb350..89f7dad 100644 --- a/dynamic/build.gradle +++ b/dynamic/build.gradle @@ -19,6 +19,8 @@ plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' + id 'stringfog' + id 'top.niunaijun.blackobfuscator' } android { @@ -47,6 +49,32 @@ android { } } +stringfog { + // 必要:加解密库的实现类路径,需和上面配置的加解密算法库一致。 + implementation 'com.github.megatronking.stringfog.xor.StringFogImpl' + // 可选:加密开关,默认开启。 + enable false + // 可选:指定需加密的代码包路径,可配置多个,未指定将默认全部加密。 + fogPackages = ['xyz.fycz.dynamic'] + // 可选:指定密钥生成器,默认使用长度2的随机密钥(每个字符串均有随机密钥), + // 也可以指定一个固定的密钥:HardCodeKeyGenerator("This is a key") + + // 可选:调试信息打印开关,默认关闭。 + debug true +} + +// 加入混淆配置 +BlackObfuscator { + // 是否启用 + enabled false + // 混淆深度 + depth 5 + // 需要混淆的包或者类(匹配前面一段) + obfClass = ["xyz.fycz.dynamic"] + // blackClass中的包或者类不会进行混淆(匹配前面一段) + blackClass = [] +} + dependencies { compileOnly("androidx.core:core-ktx:$kotlin_version") testImplementation 'junit:junit:4.13.2' @@ -56,4 +84,5 @@ dependencies { compileOnly 'org.greenrobot:greendao:3.3.0' compileOnly project(":app") compileOnly project(":DialogX") + api 'com.github.megatronking.stringfog:xor:3.0.0' } \ No newline at end of file diff --git a/dynamic/proguard-rules.pro b/dynamic/proguard-rules.pro index 481bb43..829fbe5 100644 --- a/dynamic/proguard-rules.pro +++ b/dynamic/proguard-rules.pro @@ -18,4 +18,8 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile +# 混淆字典 +-obfuscationdictionary dictionary_rules.txt +-classobfuscationdictionary dictionary_rules.txt +-packageobfuscationdictionary dictionary_rules.txt \ No newline at end of file diff --git a/dynamic/src/androidTest/java/xyz/fycz/dynamic/ExampleInstrumentedTest.kt b/dynamic/src/androidTest/java/xyz/fycz/dynamic/ExampleInstrumentedTest.kt index 3e7fb54..c60186d 100644 --- a/dynamic/src/androidTest/java/xyz/fycz/dynamic/ExampleInstrumentedTest.kt +++ b/dynamic/src/androidTest/java/xyz/fycz/dynamic/ExampleInstrumentedTest.kt @@ -18,14 +18,14 @@ package xyz.fycz.dynamic +import android.util.Base64 +import android.util.Log import androidx.test.ext.junit.runners.AndroidJUnit4 -import me.fycz.maple.MapleUtils + import org.junit.Test import org.junit.runner.RunWith -import xyz.fycz.dynamic.fix.App243Fix -import xyz.fycz.myreader.application.App /** * Instrumented test, which will execute on an Android device. @@ -37,5 +37,6 @@ class ExampleInstrumentedTest { @Test fun testFix() { // Context of the app under test. + Log.d("asdas", Base64.encodeToString("asdasd".toByteArray(), Base64.NO_WRAP)) } } \ No newline at end of file diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt index 69f485a..7080fb0 100644 --- a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt +++ b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt @@ -18,7 +18,6 @@ package xyz.fycz.dynamic -import android.app.AlertDialog import android.content.Context import android.content.SharedPreferences import android.os.Bundle @@ -74,7 +73,7 @@ class AppLoadImpl : IAppLoader { } if (sb.isNotEmpty()) { if (sb.endsWith("\n")) sb.substring(0, sb.length - 1) - val key = "fix244-2" + val key = "fix245" val hasRead = spu.getBoolean(key, false) if (!hasRead) { announce("插件更新", "更新内容:\n$sb")