1

描述

在将 hermesEnabled 设置为 true 的情况下在构建期间获取以下消息

('...' 代表删除的文本):

(完整的错误日志在这里

android\app\build\generated\assets\react\release\index.android.bundle:13:134: warning: the variable "Promise" was not declared in function "isBoldTextEnabled"
...
android\app\build\generated\assets\react\release\index.android.bundle:27:2907: warning: the variable "DebuggerInternal" was not declared in function "value 14#"
...
android\app\build\generated\assets\react\release\index.android.bundle:92:57773: warning: the variable "setTimeout" was not declared in function "wi"
...

fs.js:114
    throw err;
    ^
Error: ENOENT: no such file or directory, open 'android\app\build\intermediates\sourcemaps\react\release\index.android.bundle.packager.map'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
at Object.<anonymous> (C:\esites-grocery\test2.hermes\plumpclient\node_modules\react-native\scripts\compose-source-maps.js:33:43)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)

FAILURE: Build failed with an exception.

* Where:
Script 'node_modules\react-native\react.gradle' line: 191

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1

(引用的文件存在,至少在构建失败之后)。

环境

  • 在 Windows 10 上构建
  • React Native 版本:0.62.2

我试图做的

4

2 回答 2

2

在 build.gradle 中修改以下额外包定义:

extraPackagerArgs: ["--sourcemap-output", "$buildDir/intermediates/assets/release/index.android.bundle.map"]

extraPackagerArgs: ["--sourcemap-output", "$buildDir/intermediates/sourcemaps/react/release/index.android.bundle.packager.map"]

修复了错误(警告仍然存在)。
APK 已创建并正在运行..

于 2020-10-22T07:49:02.747 回答
0

./gradlew clean

完成 ./gradlew clean 之后它对我有用。

或者

对于 Windows:

gralde clean

于 2022-01-23T11:48:02.180 回答