1、设置打包链接包的时候动态删除美颜so文件

2、设置debug包不上传Google uploadCrashlyticsMappingFile 任务需要访问 Firebase 服务器来上传符号文件(mapping file)
This commit is contained in:
老皮 2024-11-08 13:27:10 +08:00
parent 211a6bd2de
commit 336b433513
2 changed files with 47 additions and 12 deletions

View File

@ -4,10 +4,12 @@ apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.alibaba.arouter'
apply from: "../package_config.gradle"
apply plugin: 'com.google.firebase.crashlytics'
android {
namespace "myname.pdlive.shayu"
compileSdk rootProject.ext.android.compileSdkVersion
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
@ -68,7 +70,7 @@ android {
exclude 'lib/armeabi-v7a/libMNN_CL.so'
exclude 'lib/armeabi-v7a/libMNN_Express.so'
if (rootProject.ext.manifestPlaceholders.isGooglePlay == 0) {
/*if (rootProject.ext.manifestPlaceholders.isGooglePlay == 0) {
// SO
exclude 'lib/armeabi-v7a/libCNamaSDK.so'
exclude 'lib/armeabi-v7a/libfuai.so'
@ -76,7 +78,7 @@ android {
exclude 'lib/arm64-v8a/libCNamaSDK.so'
exclude 'lib/arm64-v8a/libfuai.so'
/* // X86架构的so
// X86架构的so
exclude 'lib/x86/libagora-core.so'
exclude 'lib/x86/libagora-ffmpeg.so'
exclude 'lib/x86/libagora-fdkaac.so'
@ -99,7 +101,7 @@ android {
exclude 'lib/x86/libagora_video_encoder_extension.so'
exclude 'lib/x86/libagora_video_quality_analyzer_extension.so'
exclude 'lib/x86/libagora_video_dec.so'
exclude 'lib/x86/libagora_video_enc.so'*//*
exclude 'lib/x86/libagora_video_enc.so'/*
exclude 'lib/x86_64/libagora-core.so'
exclude 'lib/x86_64/libagora-ffmpeg.so'
@ -107,7 +109,7 @@ android {
exclude 'lib/x86_64/libagora-soundtouch.so'
exclude 'lib/x86_64/libagora-rtc-sdk.so'
*//* exclude 'lib/x86_64/libagora_clear_vision_extension.so'
/* exclude 'lib/x86_64/libagora_clear_vision_extension.so'
exclude 'lib/x86_64/libagora_segmentation_extension.so'
exclude 'lib/x86_64/libagora_screen_capture_extension.so'
exclude 'lib/x86_64/libagora_audio_beauty_extension.so'
@ -123,10 +125,13 @@ android {
exclude 'lib/x86_64/libagora_ai_echo_cancellation_extension.so'
exclude 'lib/x86_64/libagora_lip_sync_extension.so'
exclude 'lib/x86_64/libagora_video_dec.so'
exclude 'lib/x86_64/libagora_video_enc.so'*/
exclude 'lib/x86_64/libagora_video_enc.so'
*//*
}
}*/
}
compileOptions {
@ -138,6 +143,34 @@ android {
}
applicationVariants.all { variant ->
// so文件
if (variant.flavorName == "link_test" || variant.flavorName == "link_online") {
println "variant.flavorName${variant.flavorName}"
println "variant.name${variant.name}"
// 使 mergeNativeLibs
def taskName = "merge${variant.name.capitalize()}NativeLibs"
tasks.matching { it.name == taskName }.configureEach { task ->
task.doLast {
def soFiles = [
file("${buildDir}/intermediates/merged_native_libs/${variant.name}/merge${variant.name.capitalize()}NativeLibs/out/lib/armeabi-v7a/libCNamaSDK.so"),
file("${buildDir}/intermediates/merged_native_libs/${variant.name}/merge${variant.name.capitalize()}NativeLibs/out/lib/armeabi-v7a/libfuai.so"),
file("${buildDir}/intermediates/merged_native_libs/${variant.name}/merge${variant.name.capitalize()}NativeLibs/out/lib/arm64-v8a/libCNamaSDK.so"),
file("${buildDir}/intermediates/merged_native_libs/${variant.name}/merge${variant.name.capitalize()}NativeLibs/out/lib/arm64-v8a/libfuai.so")
]
soFiles.each { soFile ->
if (soFile.exists()) {
soFile.delete()
println "Deleted ${soFile.name} for ${variant.flavorName}"
} else {
println "File not found: ${soFile.path}"
}
}
}
}
}
println "清空build文件夹";
for (final def project in rootProject.getAllprojects()) {
def name = variant.name.replace('Debug', '').replace('Release', '').toLowerCase()
@ -286,10 +319,6 @@ android {
useNewCruncher = false
}
packagingOptions {// mob兼容性androidx
// pickFirst 'META-INF/*'
}
defaultConfig {
// applicationId "myname.pdlive.shayu"
@ -329,6 +358,9 @@ android {
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
firebaseCrashlytics{
mappingFileUploadEnabled = true
}
}
debug {
minifyEnabled false
@ -336,6 +368,10 @@ android {
zipAlignEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
firebaseCrashlytics{
mappingFileUploadEnabled = false
}
}
}
lintOptions {
@ -344,7 +380,6 @@ android {
}
}
repositories {
flatDir {
dirs 'libs', '../libs'

View File

@ -24,7 +24,7 @@ ext {
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
// true表示谷歌支付 false 0 (isPluginModel-> true) 1 2 3 samsung包
// 0 1 2 3 samsung包
isGooglePlay : 0,
//
isUploadLog : true,