kim*_*254 7 react-native react-native-hermes
我按照官方文档在我的应用程序中启用 Hermes 引擎,但以下内容始终返回 false:
const isHermes = () => !!global.HermesInternal;
console.log('>>>>>>>>>>>>>', isHermes());
Run Code Online (Sandbox Code Playgroud)
我所做的更改是在 android/app/build.gradle 中设置以下内容:
project.ext.react = [
enableHermes: true, // clean and rebuild if changing
]
Run Code Online (Sandbox Code Playgroud)
然后我做了一个干净的构建:
cd android && ./gradlew clean
yarn android
Run Code Online (Sandbox Code Playgroud)
但console.log总是返回false
我也遇到了falseconsole.logging isHermes()。我意识到这是因为我使用的是普通的 Chrome 调试器(不确定内部原因)。当我刚刚在 VSCode 中 console.logged 时,我得到了true. 当您使用 Hermes 时,有一种特殊的方法(抱歉,我的“复制链接以突出显示”不起作用,大约是页面下方的 1/4),您必须设置 Chrome 调试器。不过,让它与较新版本的 Chrome 一起使用似乎存在一些问题。我现在验证我是否实际使用它的计划是比较启用 Hermes 之前和之后二进制文件的大小。
| 归档时间: |
|
| 查看次数: |
1133 次 |
| 最近记录: |