fix:增加异常捕获打印

This commit is contained in:
Max
2023-12-22 14:56:59 +08:00
parent 0e30b8e303
commit e55b4d7348
3 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package com.nnbc123.app.application
import android.content.Context
import android.util.Log
/**
* Created by Max on 2023/12/22 14:49
* Desc:
**/
object ExceptionHandler {
fun init(context: Context) {
val defaultHandler = Thread.getDefaultUncaughtExceptionHandler()
Thread.setDefaultUncaughtExceptionHandler { t, e ->
e.printStackTrace()
Log.d("ExceptionHandler", "异常捕获:${e}")
defaultHandler?.uncaughtException(t, e)
}
}
}

View File

@@ -626,6 +626,7 @@ public class XChatApplication extends BaseApp {
public void onCreate() {
super.onCreate();
instance = this;
ExceptionHandler.INSTANCE.init(instance);
BaseApp.init(this);
BasicConfig.INSTANCE.setAppContext(this.getApplicationContext());
SharedPreferenceUtils.init(this);

View File

@@ -8,6 +8,7 @@ import com.nnbc123.core.manager.zego.ZegoEngineManager;
import com.nnbc123.core.room.bean.RoomAudioSdkType;
import com.nnbc123.core.room.bean.RoomInfo;
import com.nnbc123.core.utils.LogUtils;
import com.tencent.mm.opensdk.utils.Log;
import io.agora.rtc2.Constants;
@@ -29,6 +30,7 @@ public class AudioEngineManager {
}
public void initRtcEngine(EngineType engineType) {
Log.d(TAG,"initRtcEngine() engineType:" + engineType);
switch (engineType) {
case TYPE_ZEGO:
this.iAudioEngine = ZegoEngineManager.get();