From d6b9186f52f4d95802c7fb004ddf7a09bad61e61 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Tue, 9 Nov 2021 17:00:57 +0800 Subject: [PATCH] android:add some logs when fallback to webview executors --- .../src/main/java/pub/doric/engine/DoricJSEngine.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doric-android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java b/doric-android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java index 2807807f..695d9e7b 100644 --- a/doric-android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java +++ b/doric-android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java @@ -33,6 +33,8 @@ import com.github.pengfeizhou.jscore.JSONBuilder; import com.github.pengfeizhou.jscore.JavaFunction; import com.github.pengfeizhou.jscore.JavaValue; +import java.io.PrintWriter; +import java.io.StringWriter; import java.util.ArrayList; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -103,11 +105,16 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time try { mDoricJSE = new DoricNativeJSExecutor(); } catch (Throwable e) { + StringWriter stringWriter = new StringWriter(); + e.printStackTrace(new PrintWriter(stringWriter)); + mDoricRegistry.onLog(Log.ERROR, stringWriter.toString()); //In case some unexpected errors happened if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + mDoricRegistry.onLog(Log.WARN, "Use DoricWebViewJSExecutor"); mDoricJSE = new DoricWebViewJSExecutor(Doric.application()); loadBuiltinJS("doric-web.js"); } else { + mDoricRegistry.onLog(Log.WARN, "Use DoricWebShellJSExecutor"); mDoricJSE = new DoricWebShellJSExecutor(Doric.application()); } }