Skip to content

Commit

Permalink
fix(Android): 修复Hermes调试版本字节码异常问题
Browse files Browse the repository at this point in the history
  • Loading branch information
bbssyyuui committed Jan 29, 2023
1 parent 0c21aa5 commit 24dc111
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,22 @@ protected void onCreate() {
|| HummerSDK.getJsEngine() == HummerSDK.JsEngine.NAPI_HERMES) {
// 仅用于纯Hermes调试版本
if (HummerSDK.getJsEngine() == HummerSDK.JsEngine.HERMES) {
mJsContext.evaluateJavaScript("function Recycler() {}");
if (HummerSDK.isSupportBytecode(namespace)) {
mJsContext.evaluateJavaScript("function Recycler() {}");
} else {
mJsContext.evaluateJavaScriptOnly("function Recycler() {}", "");
}
}
// 注入babel
mJsContext.evaluateJavaScript("var Babel = {}");
mJsContext.evaluateJavaScript(HummerDefinition.BABEL, "babel.js");
mJsContext.evaluateJavaScript(HummerDefinition.ES5_CORE, "HummerDefinition_es5.js");
if (HummerSDK.isSupportBytecode(namespace)) {
mJsContext.evaluateJavaScript("var Babel = {}");
mJsContext.evaluateJavaScript(HummerDefinition.BABEL, "babel.js");
mJsContext.evaluateJavaScript(HummerDefinition.ES5_CORE, "HummerDefinition_es5.js");
} else {
mJsContext.evaluateJavaScriptOnly("var Babel = {}", "");
mJsContext.evaluateJavaScriptOnly(HummerDefinition.BABEL, "babel.js");
mJsContext.evaluateJavaScriptOnly(HummerDefinition.ES5_CORE, "HummerDefinition_es5.js");
}
} else {
if (HummerSDK.isSupportBytecode(namespace)) {
mJsContext.evaluateJavaScript(HummerDefinition.CORE, "HummerDefinition.js");
Expand Down

0 comments on commit 24dc111

Please sign in to comment.