diff --git a/app/build.gradle b/app/build.gradle index 0e9b08107..c2f42ec24 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/config.gradle b/config.gradle index 395aed27b..17f2473dc 100644 --- a/config.gradle +++ b/config.gradle @@ -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,