feat: android混淆支持R8

This commit is contained in:
liuyanfeng 2024-09-08 02:00:00 +08:00
parent 105f029470
commit 887492ea58
4 changed files with 32 additions and 38 deletions

View File

@ -26,27 +26,27 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'android-junk-code' //apply plugin: 'android-junk-code'
apply plugin: 'com.huawei.agconnect' apply plugin: 'com.huawei.agconnect'
apply from: 'and_res_guard.gradle' apply from: 'and_res_guard.gradle'
androidJunkCode { //androidJunkCode {
variantConfig { // variantConfig {
release { // release {
//release是变体名称productFlavors就是buildType名称productFlavors就是flavor+buildTypefreeReleaseproRelease // //release是变体名称productFlavors就是buildType名称productFlavors就是flavor+buildTypefreeReleaseproRelease
packageBase = "cn.hx.plugin.ui" //java类根包名 // packageBase = "cn.hx.plugin.ui" //java类根包名
packageCount = 30 // // packageCount = 30 //
activityCountPerPackage = 3 //Activity类数量 // activityCountPerPackage = 3 //Activity类数量
excludeActivityJavaFile = false // excludeActivityJavaFile = false
//Activity的Java文件,false(layout和写入AndroidManifest.xml还会执行) // //Activity的Java文件,false(layout和写入AndroidManifest.xml还会执行)
otherCountPerPackage = 50 // // otherCountPerPackage = 50 //
methodCountPerClass = 20 // // methodCountPerClass = 20 //
resPrefix = "junk_" //layoutdrawablestring等资源名前缀 // resPrefix = "junk_" //layoutdrawablestring等资源名前缀
drawableCount = 300 //drawable资源数量 // drawableCount = 300 //drawable资源数量
stringCount = 300 //string数量 // stringCount = 300 //string数量
} // }
} // }
} //}
android { android {
signingConfigs { signingConfigs {
@ -178,21 +178,18 @@ android {
// //
XIAOMI_APPID : "MI-2882303761520314939", XIAOMI_APPID : "MI-2882303761520314939",
XIAOMI_APPKEY : "MI-5312031456939", XIAOMI_APPKEY : "MI-5312031456939",
<<<<<<< Updated upstream
OPPO_APPKEY : "OP-47f668c9943248118502aa58d066393b", OPPO_APPKEY : "OP-47f668c9943248118502aa58d066393b",
OPPO_APPID : "OP-31726001", OPPO_APPID : "OP-31726001",
OPPO_APPSECRET : "OP-05723986bba64183a71530b496922450", OPPO_APPSECRET : "OP-05723986bba64183a71530b496922450",
// VIVO_APPKEY : "vivo的APPKEY", // VIVO_APPKEY : "vivo的APPKEY",
// VIVO_APPID : "vivo的APPID", // VIVO_APPID : "vivo的APPID",
HONOR_APPID : "110798531", HONOR_APPID : "110798531",
=======
OPPO_APPKEY : "OP-47f668c9943248118502aa58d066393b", OPPO_APPKEY : "OP-47f668c9943248118502aa58d066393b",
OPPO_APPID : "OP-31726001", OPPO_APPID : "OP-31726001",
OPPO_APPSECRET: "OP-05723986bba64183a71530b496922450", OPPO_APPSECRET: "OP-05723986bba64183a71530b496922450",
VIVO_APPKEY : "75fe8e570425b714e08d0390b14797cb", VIVO_APPKEY : "75fe8e570425b714e08d0390b14797cb",
VIVO_APPID : "105752244", VIVO_APPID : "105752244",
HONOR_APPID : "104458196", HONOR_APPID : "104458196",
>>>>>>> Stashed changes
] ]
splits { splits {
abi { abi {
@ -261,14 +258,10 @@ dependencies {
implementation 'com.google.code.gson:gson:2.6.2' implementation 'com.google.code.gson:gson:2.6.2'
implementation 'commons-codec:commons-codec:1.6' implementation 'commons-codec:commons-codec:1.6'
implementation 'androidx.annotation:annotation:1.1.0' implementation 'androidx.annotation:annotation:1.1.0'
<<<<<<< Updated upstream
=======
// 耀 // 耀
implementation 'cn.jiguang.sdk.plugin:honor:5.2.3' implementation 'cn.jiguang.sdk.plugin:honor:5.2.3'
//耀 aar SDK jpush-android-xxx-release/third-push/honor/libs 下的 aar 文件单独拷贝一份到应用 module/libs //耀 aar SDK jpush-android-xxx-release/third-push/honor/libs 下的 aar 文件单独拷贝一份到应用 module/libs
// implementation(name: 'HiPushSDK-7.0.61.303', ext: 'aar') // implementation(name: 'HiPushSDK-7.0.61.303', ext: 'aar')
// VIVO // VIVO
implementation 'cn.jiguang.sdk.plugin:vivo:5.2.3' implementation 'cn.jiguang.sdk.plugin:vivo:5.2.3'
>>>>>>> Stashed changes
} }

View File

@ -94,21 +94,22 @@
-keep class com.google.gson.** {*;} -keep class com.google.gson.** {*;}
-keep class com.google.protobuf.** {*;} -keep class com.google.protobuf.** {*;}
-keep class com.amap.api.maps.**{*;} -keep class com.amap.api.maps.** { *; }
-keep class com.autonavi.**{*;} -keep class com.autonavi.** { *; }
-keep class com.amap.api.trace.**{*;} -keep class com.amap.api.trace.** {*; }
-keep class com.amap.api.location.**{*;} -keep class com.amap.api.location.** {*; }
-keep class com.amap.api.fence.**{*;} -keep class com.amap.api.fence.** { *; }
-keep class com.loc.**{*;} -keep class com.loc.** { *; }
-keep class com.autonavi.aps.amapapi.model.**{*;} -keep class com.amap.flutter.location.** { *; }
-keep class com.autonavi.aps.amapapi.model.** { *; }
-keep class com.amap.api.services.**{*;} -keep class com.amap.api.services.** { *; }
-keep class com.amap.api.maps2d.**{*;} -keep class com.amap.api.maps2d.** { *; }
-keep class com.amap.api.mapcore2d.**{*;} -keep class com.amap.api.mapcore2d.** { *; }
-keep class com.amap.api.navi.**{*;} -keep class com.amap.api.navi.** { *; }
-keep class com.alipay.deviceid.** { *; } -keep class com.alipay.deviceid.** { *; }

View File

@ -21,7 +21,7 @@ buildscript {
// hms // hms
classpath 'com.huawei.agconnect:agcp:1.6.0.300' classpath 'com.huawei.agconnect:agcp:1.6.0.300'
// //
classpath "com.github.qq549631030:android-junk-code:1.3.3" // classpath "com.github.qq549631030:android-junk-code:1.3.3"
classpath'com.tencent.mm:AndResGuard-gradle-plugin:1.2.21' classpath'com.tencent.mm:AndResGuard-gradle-plugin:1.2.21'
} }

View File

@ -48,8 +48,8 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage>
super.initState(); super.initState();
AMapFlutterLocation.updatePrivacyAgree(true); AMapFlutterLocation.updatePrivacyAgree(true);
AMapFlutterLocation.updatePrivacyShow(true, true); AMapFlutterLocation.updatePrivacyShow(true, true);
requestPermission();
AMapFlutterLocation.setApiKey(F.aMapKey.androidKey, F.aMapKey.iosKey); AMapFlutterLocation.setApiKey(F.aMapKey.androidKey, F.aMapKey.iosKey);
requestPermission();
} }
// Future<void> requestPermission() async { // Future<void> requestPermission() async {