feat:新增隔离模式配置

This commit is contained in:
Max
2023-11-23 17:08:19 +08:00
parent 9cacea3ef4
commit 5287533ee8
6 changed files with 45 additions and 29 deletions

Binary file not shown.

View File

@@ -1,9 +1,8 @@
apply plugin: 'com.android.application'
//apply plugin: 'com.google.gms.google-services'
//apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
apply plugin: 'com.tencent.vasdolly'
apply from: '../mob.gradle'
apply from: '../project.gradle'
def onlyArm64 = Boolean.parseBoolean(only_arm64)
@@ -11,7 +10,7 @@ android {
compileSdkVersion COMPILE_SDK_VERSION.toInteger()
defaultConfig {
applicationId "com.example.live"
applicationId isolationMode ? 'com.aaa.bbb' : 'com.example.live'
minSdkVersion MIN_SDK_VERSION.toInteger()
targetSdkVersion TARGET_SDK_VERSION.toInteger()
versionCode Integer.valueOf(version_code)
@@ -21,8 +20,7 @@ android {
multiDexEnabled true
flavorDimensions 'default'
// manifestPlaceholders = [CRASHLYTICS_COLLECTION_ENABLED: CRASHLYTICS_COLLECTION_ENABLED.toBoolean()]
buildConfigField "boolean", "ISOLATION_MODE", "$isolationMode"
}
splits {
@@ -78,27 +76,26 @@ android {
enabled = true
}
// signingConfigs {
//
// v2 {
// storeFile file('../ananplay.jks')
// storePassword "vele2021"
// keyAlias "ananplay"
// keyPassword "vele2021"
// v2SigningEnabled true
// v1SigningEnabled true
// }
//
// v1 {
// storeFile file('../ananplay.jks')
// storePassword "vele2021"
// keyAlias "ananplay"
// keyPassword "vele2021"
// v2SigningEnabled false
// v1SigningEnabled true
// }
//
// }
signingConfigs {
debug {
storeFile file('../app_debug.jks')
storePassword "debug2023"
keyAlias "debug"
keyPassword "debug2023"
v2SigningEnabled true
v1SigningEnabled true
}
release {
storeFile file('../app_debug.jks')
storePassword "debug2023"
keyAlias "debug"
keyPassword "debug2023"
v2SigningEnabled true
v1SigningEnabled true
}
}
sourceSets {
@@ -163,7 +160,7 @@ android {
minifyEnabled minify_enabled.toBoolean() // 是否混淆
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
crunchPngs false // 停用 PNG 压缩
// signingConfig signingConfigs.v2
signingConfig isolationMode ? signingConfigs.debug : signingConfigs.release
gradle.taskGraph.whenReady {
tasks.each { task ->
if (task.name.contains("Test") || task.name.contains("Lint")) {
@@ -189,7 +186,7 @@ android {
shrinkResources true // 开了混淆的时候才能开启 是否去除无效的资源文件
zipAlignEnabled true // 开了混淆的时候才能开启 是否进行压缩并重排列
crunchPngs true // 启用 PNG 压缩
// signingConfig signingConfigs.v2
signingConfig isolationMode ? signingConfigs.debug : signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
@@ -304,7 +301,10 @@ dependencies {
implementation 'tech.sud.mgp:SudMGP-static:1.3.3.1158'
implementation project(':modules:module_google')
implementation project(':modules:module_base')
if (!isolationMode) {
implementation project(':modules:module_google')
}
}
channel {

BIN
app_debug.jks Normal file

Binary file not shown.

View File

@@ -23,6 +23,9 @@ MobSDK.spEdition=FP
only_arm64=false
minify_enabled=false
# 是否隔离模式换包名、换签名、隐藏部分SDK-KEY信息、去掉部分SDKGoogle相关
isolation_mode=true
channel_file=channel.txt
CRASHLYTICS_COLLECTION_ENABLED=false

Binary file not shown.

13
project.gradle Normal file
View File

@@ -0,0 +1,13 @@
ext {
isolationMode = isReleaseBuildType() ? false : Boolean.valueOf(isolation_mode)
println("是否隔离模式:" + isolationMode)
}
boolean isReleaseBuildType() {
for (String s : gradle.startParameter.taskNames) {
if (s.contains("Release") | s.contains("release")) {
return true
}
}
return false
}