Allow disabling Hermes engine by passing flag while building app (#14041)

This commit is contained in:
Parvesh Monu 2022-09-21 14:56:26 +05:30 committed by GitHub
parent 17fd6df773
commit 147958dd13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 1 deletions

View File

@ -76,13 +76,22 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy
* extraPackagerArgs: [] * extraPackagerArgs: []
* ] * ]
*/ */
/*
Enabling Hermes on x86 devices is crashing the app after a few reloads,
this flag can be used to disable Hermes while building app.
https://github.com/status-im/status-mobile/issues/14031
*/
def disableHermes = System.getenv('DISABLE_HERMES') == 'true'
project.ext.react = [ project.ext.react = [
nodeExecutableAndArgs: ["node", "--max-old-space-size=16384"], nodeExecutableAndArgs: ["node", "--max-old-space-size=16384"],
entryFile: "index.js", entryFile: "index.js",
/* NOTE: Hermes engine is required for Android 64-bit builds running on 64 devices, /* NOTE: Hermes engine is required for Android 64-bit builds running on 64 devices,
* to guard against a hang in the UI thread after invoking status-go. * to guard against a hang in the UI thread after invoking status-go.
* Also a clean and rebuild is required when changing this. */ * Also a clean and rebuild is required when changing this. */
enableHermes: true, enableHermes: !disableHermes,
/* Disable 'The first definition was here.' warnings */ /* Disable 'The first definition was here.' warnings */
hermesFlagsRelease: ["-w"], hermesFlagsRelease: ["-w"],
bundleInPr: true, bundleInPr: true,

View File

@ -97,3 +97,32 @@ System's local adb and Nix's adb differ. As adb include of server/client process
Always use respective `make` commands, e.g. `make android-ports`, `make android-devices`, etc. Always use respective `make` commands, e.g. `make android-ports`, `make android-devices`, etc.
Alternatively, run adb commands only from `make shell TARGET=android` shell. Don't forget the `TARGET=android` env var setting - otherwise `adb` will still be selected from the system's default location. You can double-check this by running `which adb`. Alternatively, run adb commands only from `make shell TARGET=android` shell. Don't forget the `TARGET=android` env var setting - otherwise `adb` will still be selected from the system's default location. You can double-check this by running `which adb`.
# Hot Reloading Crashes
## APP Crashes on reloading changes
### Cause
Status-mobile uses `shadow-cljs` for hot reloading changes and uses its own [reloader](https://github.com/status-im/status-mobile/blob/develop/src/status_im/reloader.cljs) for updating them in the running app. If react-native's fast refresh is also enabled then it creates conflicts and crashes the app.
### Solution
Open react native's [In-App Developer Menu](https://reactnative.dev/docs/debugging#accessing-the-in-app-developer-menu) and press "Disable Fast Refresh" or "Disable Hot Reloading"
## App Crashes after few reloads
### Cause
For x86 CPU architecture Android Devices, Hermes is creating the issue and the app crashes after a few reloads.
([Original Issue](https://github.com/status-im/status-mobile/issues/14031))
<details>
<summary>How to Find CPU architecture</summary>
CPU architecture of android device can be found using
- `adb shell uname -m` or
- `adb shell getprop ro.product.cpu.abilist`
</details>
### Solution
Disable Hermes while building the app
`make run-android DISABLE_HERMES=true`