diff --git a/android/hummer-sdk/src/main/java/com/didi/hummer/context/HummerContext.java b/android/hummer-sdk/src/main/java/com/didi/hummer/context/HummerContext.java index 7eb7a4bf..b606718c 100644 --- a/android/hummer-sdk/src/main/java/com/didi/hummer/context/HummerContext.java +++ b/android/hummer-sdk/src/main/java/com/didi/hummer/context/HummerContext.java @@ -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");