diff --git a/app/build.gradle b/app/build.gradle index 73567955c..22fa13570 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,6 +6,9 @@ apply plugin: 'com.alibaba.arouter' android { dexOptions { jumboMode = true + } + project.tasks.getByName("tasks").doFirst { + } /* applicationVariants.all { variant -> variant.mergeAssetsProvider.configure { @@ -93,7 +96,7 @@ android { exclude 'lib/armeabi-v7a/libMNN_CL.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/arm64-v8a/libCNamaSDK.so' exclude 'lib/armeabi-v7a/libfuai.so' @@ -106,6 +109,11 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } applicationVariants.all { variant -> + println "清空build文件夹"; + for (final def project in rootProject.getAllprojects()) { + delete project.buildDir + println project.buildDir + } String variantName = variant.name.capitalize() def processManifestTask = project.tasks.getByName("process${variantName}Manifest") processManifestTask.doLast { pm -> @@ -149,17 +157,33 @@ android { //美颜基础组件 ])) - println "isPluginModel = "+rootProject.ext.manifestPlaceholders.isPluginModel - if(rootProject.ext.manifestPlaceholders.isPluginModel){ + println "isPluginModel = " + rootProject.ext.manifestPlaceholders.isPluginModel + if (rootProject.ext.manifestPlaceholders.isPluginModel) { delete(fileTree(dir: outputDir, includes: [ 'model/ai_face_processor_lite.bundle', 'graphics/face_beautification.bundle' ])) - }else { + } else { 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 { release { diff --git a/app/src/main/java/com/shayu/phonelive/utils/PluginManager.java b/app/src/main/java/com/shayu/phonelive/utils/PluginManager.java index 0747df080..35121e0db 100644 --- a/app/src/main/java/com/shayu/phonelive/utils/PluginManager.java +++ b/app/src/main/java/com/shayu/phonelive/utils/PluginManager.java @@ -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.FaceUnityConfig.BUNDLE_FACE_BEAUTIFICATION; -import android.content.Context; import android.os.Build; import android.util.Log; @@ -16,15 +15,10 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.lang.reflect.Field; import java.util.Arrays; import java.util.zip.ZipEntry; 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"; loadFaceSo(sdk, outDir); loadFaceBundle(sdk, outDir); - getAnchorPluginVersion(); }).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文件 diff --git a/config.gradle b/config.gradle index 110b5f553..0fb0b7c81 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] 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",