小编Meh*_*rad的帖子

如何在更新的 React-Native 项目中启用 Hermes 引擎?

我正在开发一个反应本机项目,该项目最初使用旧的反应本机版本。更新项目以使用最新的react-native版本,在其他方面都非常成功。但是,我无法为 Android 启用 Hermes 引擎。

我已按照此处的官方步骤操作:Using Hermes。为了确认 Hermes 是否已启用,我清理并重建了 android 项目,在调试模式下运行应用程序并使用以下代码:

const isHermes = () => !!global.HermesInternal;
console.log(isHermes());
Run Code Online (Sandbox Code Playgroud)

Flipper v0.80.0 也找不到 Hermes 应用程序。

android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
        ndkVersion = "20.1.5948944"
        supportLibVersion = "29.0.0"
        googlePlayServicesVersion = "+"
        firebaseVersion = "+"
        ext.kotlinVersion = '1.3.10'
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:4.1.0')
        classpath "com.google.gms:google-services:4.3.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            url("$rootDir/../node_modules/react-native/android") …
Run Code Online (Sandbox Code Playgroud)

android build.gradle react-native react-native-hermes

9
推荐指数
0
解决办法
4552
查看次数