1、声网里美颜(相心)so动态加载 开发基本完成
2、Gradle速度很慢,配置缓存等设置
This commit is contained in:
parent
b4a4302cc7
commit
cbd99e0664
@ -21,7 +21,7 @@ app 主程序
|
||||
common 公共模块
|
||||
FaceUnity 美颜模块
|
||||
IAP6Helper 三星模块
|
||||
lib_faceunity 声网美颜模块
|
||||
lib_faceunity 声网模块
|
||||
lib_google 谷歌模块
|
||||
lib_huawei 华为模块
|
||||
live 直播间模块
|
||||
|
@ -67,12 +67,17 @@ android {
|
||||
exclude 'lib/armeabi-v7a/libmmlic.so'
|
||||
exclude 'lib/armeabi-v7a/libMNN_CL.so'
|
||||
exclude 'lib/armeabi-v7a/libMNN_Express.so'
|
||||
//美颜
|
||||
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
||||
|
||||
// 链接包剔除相心美颜SO
|
||||
if (rootProject.ext.manifestPlaceholders.isGooglePlay == 0) {
|
||||
exclude 'lib/armeabi-v7a/libCNamaSDK.so'
|
||||
exclude 'lib/arm64-v8a/libCNamaSDK.so'
|
||||
exclude 'lib/x86_64/libCNamaSDK.so'
|
||||
exclude 'lib/x86/libCNamaSDK.so'
|
||||
exclude 'lib/armeabi-v7a/libfuai.so'
|
||||
exclude 'lib/arm64-v8a/libfuai.so'
|
||||
exclude 'lib/x86_64/libfuai.so'
|
||||
exclude 'lib/x86/libfuai.so'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
|
@ -1,22 +1,16 @@
|
||||
package com.shayu.phonelive.activity;
|
||||
|
||||
|
||||
import static com.yunbao.live.views.SystemMessageViewHolder.PERMISSION_REQUEST_CODE;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
@ -30,20 +24,15 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.ActivityOptionsCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.shayu.phonelive.AppContext;
|
||||
import com.tencent.rtmp.ITXLivePlayListener;
|
||||
import com.tencent.rtmp.TXLiveBase;
|
||||
@ -65,14 +54,12 @@ import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.DownloadUtil;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.LogUtil;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.views.LauncherAdViewHolder;
|
||||
import com.yunbao.main.activity.EntryActivity;
|
||||
import com.yunbao.main.activity.MainActivity;
|
||||
@ -178,13 +165,41 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000);
|
||||
}else {
|
||||
//链接包 下载so库
|
||||
downLoadSo();
|
||||
checkFaceUnitySOFile();
|
||||
checkAgoraSOFile();
|
||||
}
|
||||
}
|
||||
|
||||
private void downLoadSo() {
|
||||
|
||||
private void checkFaceUnitySOFile() {
|
||||
File outputDir = new File(mContext.getDir("lib", Context.MODE_PRIVATE).getAbsoluteFile(), Constants.DOWNLOAD_FaceUnity_SO);
|
||||
String cpuAbi = "";
|
||||
cpuAbi = Build.CPU_ABI;
|
||||
if (!outputDir.exists()) {
|
||||
outputDir.mkdirs();
|
||||
}
|
||||
File fileSo = new File(outputDir, Constants.FaceUnity_SO_Name);
|
||||
File fileSoList = new File(outputDir, cpuAbi);
|
||||
//解压后的文件数量必须要有2个
|
||||
//如果文件存在,解压后 文件数量一致,直接进入下一步
|
||||
if (fileSo.exists() && getFileCount(fileSoList.getAbsolutePath()) == 2){
|
||||
return;
|
||||
}
|
||||
// https://downs.yaoulive.com/androidLibs/t3/faceunity2-so-arm64-v8a.zip
|
||||
String soUrl = String.format("https://downs.yaoulive.com/androidLibs/t3/faceunity2-so-%s.zip", cpuAbi);
|
||||
Log.i("download", soUrl);
|
||||
|
||||
if (!fileSo.exists()) {
|
||||
downloadSo(outputDir.getAbsolutePath(), soUrl,Constants.FaceUnity_SO_Name,false);
|
||||
}else if (fileSo.exists() && getFileCount(outputDir.getAbsolutePath()) < 3) {
|
||||
fileSo.delete();
|
||||
downloadSo(outputDir.getAbsolutePath(), soUrl,Constants.FaceUnity_SO_Name,false);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAgoraSOFile() {
|
||||
//存储路径 //检查是否下载过
|
||||
File outputDir = new File(mContext.getDir("lib", Context.MODE_PRIVATE).getAbsoluteFile(), Constants.DOWNLOAD_SO);
|
||||
File outputDir = new File(mContext.getDir("lib", Context.MODE_PRIVATE).getAbsoluteFile(), Constants.DOWNLOAD_Agora_SO);
|
||||
Log.i("downLoad", "outputDir.getAbsolutePath() = " + outputDir.getAbsolutePath());
|
||||
|
||||
String cpuAbi = "";
|
||||
@ -194,7 +209,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
Log.e("downLoad", "outputDir:>>>" + outputDir.exists());
|
||||
outputDir.mkdirs();
|
||||
}
|
||||
File fileSo = new File(outputDir, "soKuZip.zip");
|
||||
File fileSo = new File(outputDir, Constants.Agora_SO_Name);
|
||||
Log.i("downLoad", "fileSo.getAbsolutePath() = " + fileSo.getAbsolutePath());
|
||||
|
||||
File fileSoList = new File(outputDir, cpuAbi);
|
||||
@ -213,18 +228,16 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
//2开始下载
|
||||
//检查压缩包是否已经下载过
|
||||
|
||||
Log.i("download", "permission WRITE_EXTERNAL_STORAGE.." + ContextCompat.checkSelfPermission(LauncherActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE));
|
||||
Log.i("download", "permission READ_EXTERNAL_STORAGE .." + ContextCompat.checkSelfPermission(LauncherActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE));
|
||||
String soUrl = String.format("https://downs.yaoulive.com/so-%s.zip", cpuAbi);
|
||||
String soUrl = String.format("https://downs.yaoulive.com/androidLibs/t1/agora-so-%s.zip", cpuAbi);
|
||||
// https://downs.yaoulive.com/androidLibs/t1/agora-so-arm64-v8a.zip
|
||||
Log.i("download", soUrl);
|
||||
|
||||
if (!fileSo.exists()) {
|
||||
downloadSo(outputDir.getAbsolutePath(), soUrl);
|
||||
downloadSo(outputDir.getAbsolutePath(), soUrl,Constants.Agora_SO_Name,true);
|
||||
}else if (fileSo.exists() && getFileCount(outputDir.getAbsolutePath()) < 23) {
|
||||
fileSo.delete();
|
||||
downloadSo(outputDir.getAbsolutePath(), soUrl);
|
||||
downloadSo(outputDir.getAbsolutePath(), soUrl,Constants.Agora_SO_Name,true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Dialog progressDialog;
|
||||
@ -251,34 +264,32 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
}
|
||||
public void downloadSo(String outputDir, String downloadUrl) {
|
||||
public void downloadSo(String outputDir, String downloadUrl,String fileName,boolean isShowDialog) {
|
||||
DownloadUtil downloadUtil = new DownloadUtil();
|
||||
if(isShowDialog){
|
||||
showDialog(LauncherActivity.this);
|
||||
downloadUtil.download("so", outputDir, "soKuZip.zip", downloadUrl, new DownloadUtil.Callback() {
|
||||
}
|
||||
downloadUtil.download("so", outputDir, fileName, downloadUrl, new DownloadUtil.Callback() {
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
if (isShowDialog){
|
||||
progressDialog.dismiss();
|
||||
//存储路径
|
||||
// File outputDir = new File(getApplicationInfo().dataDir, "dataLib");
|
||||
//
|
||||
// if (!outputDir.exists()) {
|
||||
// Log.e("downLoad", "outputDir:>>>" + outputDir.exists());
|
||||
// outputDir.mkdirs();
|
||||
// }
|
||||
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 20);
|
||||
File fileSo = new File(outputDir, "soKuZip.zip");
|
||||
}
|
||||
File fileSo = new File(outputDir, fileName);
|
||||
try {
|
||||
unzip(fileSo.getAbsolutePath(), outputDir);
|
||||
} catch (Exception e) {
|
||||
Log.e("ZipCheck", "Error reading ZIP file", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
if (isShowDialog){
|
||||
progressBar.setProgress(progress);
|
||||
}
|
||||
Log.i("downLoad", "progress:>>>" + progress);
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,6 @@ buildscript {
|
||||
classpath "com.github.jadepeakpoet.ARouter:arouter-register:1.0.3"
|
||||
classpath 'com.huawei.agconnect:agcp:1.5.2.300'
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -178,6 +178,7 @@ dependencies {
|
||||
//腾讯im
|
||||
api 'com.tencent.imsdk:imsdk-plus:5.4.666'
|
||||
api 'com.google.code.gson:gson:2.8.8'
|
||||
|
||||
api 'cn.rongcloud.sdk:rtc_lib:5.7.0' // 音视频通话基础能力库
|
||||
//此处以集成 5.1.2 版本为例
|
||||
api 'cn.rongcloud.sdk:im_lib:5.7.0'
|
||||
@ -186,6 +187,7 @@ dependencies {
|
||||
api 'cn.rongcloud.sdk:im_kit:5.7.0' // 即时通讯 UI 基础组件
|
||||
//融云小视频模块
|
||||
api 'cn.rongcloud.sdk:sight:5.7.0'
|
||||
|
||||
api 'com.facebook.android:facebook-android-sdk:15.2.0'
|
||||
implementation 'com.facebook.android:facebook-android-sdk:15.2.0'
|
||||
|
||||
|
@ -316,6 +316,10 @@ public class Constants {
|
||||
public static int firstInto = 0;//
|
||||
|
||||
// 声网so
|
||||
public static final String DOWNLOAD_SO = "agora_lib";
|
||||
public static final String DOWNLOAD_Agora_SO = "agora_lib";
|
||||
public static final String Agora_SO_Name = "agora_lib.zip";
|
||||
// 美颜SO
|
||||
public static final String DOWNLOAD_FaceUnity_SO = "faceunity_lib";
|
||||
public static final String FaceUnity_SO_Name = "faceunity_lib.zip";
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ ext {
|
||||
isPluginModel : false,
|
||||
facebook_app_id : "2011402032399020",
|
||||
facebook_client_token : "959584e054a33614996361f0044e5253",
|
||||
lineChannelId : "1656399535",
|
||||
isAppBundle: true
|
||||
lineChannelId : "1656399535"
|
||||
]
|
||||
}
|
||||
|
@ -13,11 +13,15 @@
|
||||
#Thu Feb 04 00:05:45 CST 2021
|
||||
android.injected.testOnly=false
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=4096m -XX:+UseParallelGC -Dfile.encoding=UTF-8
|
||||
#org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
||||
org.gradle.parallel=true
|
||||
org.gradle.unsafe.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
||||
org.gradle.configureondemand=true
|
||||
|
||||
|
||||
org.gradle.workers.max=8
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
android.nonTransitiveRClass=false
|
||||
|
@ -2,34 +2,20 @@ package io.agora.beautyapi.faceunity.agora;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.opengl.EGL14;
|
||||
import android.opengl.EGLConfig;
|
||||
import android.opengl.EGLContext;
|
||||
import android.opengl.EGLDisplay;
|
||||
import android.opengl.EGLSurface;
|
||||
import android.opengl.GLES20;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.Surface;
|
||||
import android.view.TextureView;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
|
||||
import com.faceunity.wrapper.faceunity;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.manager.MicUserManager;
|
||||
import com.yunbao.common.manager.MicedUserManager;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
@ -41,15 +27,6 @@ import io.agora.rtc2.RtcConnection;
|
||||
import io.agora.rtc2.RtcEngineConfig;
|
||||
import io.agora.rtc2.RtcEngineEx;
|
||||
import io.agora.rtc2.video.VideoCanvas;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
/**
|
||||
* 声网用户管理类
|
||||
@ -120,9 +97,14 @@ public class SWAuManager extends BaseCacheManager {
|
||||
//链接包,声网加载下载的 So文件
|
||||
String cpuAbi = "";
|
||||
cpuAbi = Build.CPU_ABI;
|
||||
File file = new File(mContext.getDir("lib", Context.MODE_PRIVATE).getAbsoluteFile(), com.yunbao.common.Constants.DOWNLOAD_SO + File.separator + cpuAbi);
|
||||
File file = new File(mContext.getDir("lib", Context.MODE_PRIVATE).getAbsoluteFile(), com.yunbao.common.Constants.DOWNLOAD_Agora_SO + File.separator + cpuAbi);
|
||||
config.mNativeLibPath = file.getAbsolutePath();
|
||||
Log.i("downLoad", "config.mNativeLibPath 1 = " + config.mNativeLibPath);
|
||||
Log.i("downLoad", "声网 SO Path = " + config.mNativeLibPath);
|
||||
|
||||
// 美颜SO设置
|
||||
File file_FaceUnity = new File(mContext.getDir("lib", Context.MODE_PRIVATE).getAbsoluteFile(), com.yunbao.common.Constants.DOWNLOAD_FaceUnity_SO + File.separator + cpuAbi);
|
||||
faceunity.LoadConfig.loadLibrary(file_FaceUnity.getAbsolutePath());
|
||||
Log.i("downLoad", "美颜SO Path = " + file_FaceUnity.getAbsolutePath());
|
||||
}
|
||||
|
||||
// 创建并初始化 RtcEngine
|
||||
@ -151,7 +133,7 @@ public class SWAuManager extends BaseCacheManager {
|
||||
//链接包,声网加载下载的 So文件
|
||||
String cpuAbi = "";
|
||||
cpuAbi = Build.CPU_ABI;
|
||||
File file = new File(mContext.getDir("lib", Context.MODE_PRIVATE).getAbsoluteFile(), com.yunbao.common.Constants.DOWNLOAD_SO + File.separator + cpuAbi);
|
||||
File file = new File(mContext.getDir("lib", Context.MODE_PRIVATE).getAbsoluteFile(), com.yunbao.common.Constants.DOWNLOAD_Agora_SO + File.separator + cpuAbi);
|
||||
config.mNativeLibPath = file.getAbsolutePath();
|
||||
Log.i("downLoad", "config.mNativeLibPath 2 = " + config.mNativeLibPath);
|
||||
}
|
||||
|
@ -1,13 +1,10 @@
|
||||
package io.agora.beautyapi.faceunity.agora;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceView;
|
||||
import android.widget.FrameLayout;
|
||||
@ -19,9 +16,7 @@ import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.SwTokenModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
import com.yunbao.common.utils.DebugUtils;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@ -44,7 +39,6 @@ import io.agora.rtc2.ChannelMediaOptions;
|
||||
import io.agora.rtc2.Constants;
|
||||
import io.agora.rtc2.IRtcEngineEventHandler;
|
||||
import io.agora.rtc2.RtcConnection;
|
||||
import io.agora.rtc2.RtcEngine;
|
||||
import io.agora.rtc2.RtcEngineConfig;
|
||||
import io.agora.rtc2.RtcEngineEx;
|
||||
import io.agora.rtc2.video.ContentInspectConfig;
|
||||
@ -130,12 +124,11 @@ public class SWManager extends BaseCacheManager {
|
||||
config.mContext = mContext;
|
||||
config.mAppId = CommonAppConfig.getSwAppId();
|
||||
config.mEventHandler = mRtcEventHandler;
|
||||
|
||||
if(CommonAppConfig.IS_GOOGLE_PLAY == 0){
|
||||
//链接包,声网加载下载的 So文件
|
||||
String cpuAbi = "";
|
||||
cpuAbi = Build.CPU_ABI;
|
||||
File file = new File(mContext.getDir("lib", Context.MODE_PRIVATE).getAbsoluteFile(), com.yunbao.common.Constants.DOWNLOAD_SO + File.separator + cpuAbi);
|
||||
File file = new File(mContext.getDir("lib", Context.MODE_PRIVATE).getAbsoluteFile(), com.yunbao.common.Constants.DOWNLOAD_Agora_SO + File.separator + cpuAbi);
|
||||
config.mNativeLibPath = file.getAbsolutePath();
|
||||
Log.i("downLoad", "config.mNativeLibPath 2 = " + config.mNativeLibPath);
|
||||
}
|
||||
@ -176,7 +169,6 @@ public class SWManager extends BaseCacheManager {
|
||||
anchorContainer.addView(surfaceView);
|
||||
Config config = new Config(mContext, mRtcEngine, FURenderer.INSTANCE.mFURenderKit, null, CaptureMode.Agora, 0, false, new CameraConfig(MirrorMode.MIRROR_NONE, MirrorMode.MIRROR_NONE));
|
||||
faceUnityBeautyAPI.initialize(config);
|
||||
|
||||
faceUnityBeautyAPI.setBeautyPreset(BeautyPreset.CUSTOM);
|
||||
//FaceUnityBeautyManage.getInstance().mFURenderKit.setFaceBeauty();
|
||||
|
||||
|
@ -45,6 +45,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.faceunity.wrapper.faceunity;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.jakewharton.rxbinding3.view.RxView;
|
||||
|
Loading…
Reference in New Issue
Block a user