From 147958dd135aeb5abbf1c792e70f8fcfcc2c4c91 Mon Sep 17 00:00:00 2001 From: Parvesh Monu Date: Wed, 21 Sep 2022 14:56:26 +0530 Subject: [PATCH] Allow disabling Hermes engine by passing flag while building app (#14041) --- android/app/build.gradle | 11 ++++++++++- doc/TROUBLESHOOTING.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index fb0996cb85..e9de80fe96 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -76,13 +76,22 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy * 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 = [ nodeExecutableAndArgs: ["node", "--max-old-space-size=16384"], entryFile: "index.js", /* 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. * Also a clean and rebuild is required when changing this. */ - enableHermes: true, + enableHermes: !disableHermes, /* Disable 'The first definition was here.' warnings */ hermesFlagsRelease: ["-w"], bundleInPr: true, diff --git a/doc/TROUBLESHOOTING.md b/doc/TROUBLESHOOTING.md index 90df9209ad..f997ce82f6 100644 --- a/doc/TROUBLESHOOTING.md +++ b/doc/TROUBLESHOOTING.md @@ -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. 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)) + +
+ How to Find CPU architecture + + CPU architecture of android device can be found using + - `adb shell uname -m` or + - `adb shell getprop ro.product.cpu.abilist` + +
+ +### Solution +Disable Hermes while building the app + +`make run-android DISABLE_HERMES=true` \ No newline at end of file