This commit is contained in:
zlzw 2023-06-15 13:41:57 +08:00
parent 53ce1c703e
commit a255d1f2b5
3 changed files with 30 additions and 29 deletions

View File

@ -6,6 +6,9 @@ apply plugin: 'com.alibaba.arouter'
android { android {
dexOptions { dexOptions {
jumboMode = true jumboMode = true
}
project.tasks.getByName("tasks").doFirst {
} }
/* applicationVariants.all { variant -> /* applicationVariants.all { variant ->
variant.mergeAssetsProvider.configure { variant.mergeAssetsProvider.configure {
@ -93,7 +96,7 @@ android {
exclude 'lib/armeabi-v7a/libMNN_CL.so' exclude 'lib/armeabi-v7a/libMNN_CL.so'
exclude 'lib/armeabi-v7a/libMNN_Express.so' exclude 'lib/armeabi-v7a/libMNN_Express.so'
// //
if(rootProject.ext.manifestPlaceholders.isPluginModel) { if (rootProject.ext.manifestPlaceholders.isPluginModel) {
exclude 'lib/armeabi-v7a/libCNamaSDK.so' exclude 'lib/armeabi-v7a/libCNamaSDK.so'
exclude 'lib/arm64-v8a/libCNamaSDK.so' exclude 'lib/arm64-v8a/libCNamaSDK.so'
exclude 'lib/armeabi-v7a/libfuai.so' exclude 'lib/armeabi-v7a/libfuai.so'
@ -106,6 +109,11 @@ android {
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
applicationVariants.all { variant -> applicationVariants.all { variant ->
println "清空build文件夹";
for (final def project in rootProject.getAllprojects()) {
delete project.buildDir
println project.buildDir
}
String variantName = variant.name.capitalize() String variantName = variant.name.capitalize()
def processManifestTask = project.tasks.getByName("process${variantName}Manifest") def processManifestTask = project.tasks.getByName("process${variantName}Manifest")
processManifestTask.doLast { pm -> processManifestTask.doLast { pm ->
@ -149,17 +157,33 @@ android {
// //
])) ]))
println "isPluginModel = "+rootProject.ext.manifestPlaceholders.isPluginModel println "isPluginModel = " + rootProject.ext.manifestPlaceholders.isPluginModel
if(rootProject.ext.manifestPlaceholders.isPluginModel){ if (rootProject.ext.manifestPlaceholders.isPluginModel) {
delete(fileTree(dir: outputDir, includes: [ delete(fileTree(dir: outputDir, includes: [
'model/ai_face_processor_lite.bundle', 'model/ai_face_processor_lite.bundle',
'graphics/face_beautification.bundle' 'graphics/face_beautification.bundle'
])) ]))
}else { } else {
println "不删除bundle" println "不删除bundle"
} }
} }
} }
variant.outputs.all {
def isGoogle = "link"
if (rootProject.ext.manifestPlaceholders.isGooglePlay) {
isGoogle = "Google"
}
def isPlugin = "all"
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
isPlugin = "plugin"
}
def isTest = "测试服"
if (rootProject.ext.manifestPlaceholders.serverHost == "https://napi.yaoulive.com") {
isTest = "正式服"
}
outputFileName = "[${new Date().format("yyyy-MM-dd HHmmss", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${isGoogle}-${isPlugin}-${variant.buildType.name}-${isTest}.apk"
}
} }
signingConfigs { signingConfigs {
release { release {

View File

@ -3,7 +3,6 @@ package com.shayu.phonelive.utils;
import static com.yunbao.faceunity.utils.FURenderer.BUNDLE_AI_FACE; import static com.yunbao.faceunity.utils.FURenderer.BUNDLE_AI_FACE;
import static com.yunbao.faceunity.utils.FaceUnityConfig.BUNDLE_FACE_BEAUTIFICATION; import static com.yunbao.faceunity.utils.FaceUnityConfig.BUNDLE_FACE_BEAUTIFICATION;
import android.content.Context;
import android.os.Build; import android.os.Build;
import android.util.Log; import android.util.Log;
@ -16,15 +15,10 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
import dalvik.system.BaseDexClassLoader;
import dalvik.system.DexClassLoader;
import dalvik.system.PathClassLoader;
/** /**
* 插件加载器 * 插件加载器
*/ */
@ -75,7 +69,6 @@ public class PluginManager {
String outDir = CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin"; String outDir = CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin";
loadFaceSo(sdk, outDir); loadFaceSo(sdk, outDir);
loadFaceBundle(sdk, outDir); loadFaceBundle(sdk, outDir);
getAnchorPluginVersion();
}).start(); }).start();
} }
@ -146,22 +139,6 @@ public class PluginManager {
}); });
} }
public String getAnchorPluginVersion() {
try {
File sdk = new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk");
DexClassLoader loader = new DexClassLoader(
sdk.getAbsolutePath(),
sdk.getParent(),
sdk.getParent(),
Context.class.getClassLoader());
Object version = loader.loadClass("com.pdlive.pluginsForAnchor.MainPlugin").getMethod("getVersion").invoke(null);
Log.i(TAG, "主播插件版本号:" + version);
return (String) version;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/** /**
* 解压zip文件 * 解压zip文件

View File

@ -9,9 +9,9 @@ ext {
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
// serverHost : "https://ceshi.yaoulive.com", serverHost : "https://ceshi.yaoulive.com",
// //
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",