Understanding the use of libhermes-inspector.so, libhermes-executor-debug.so and libhermes-executor-release.so
Problem
Hi,
I was integrating Hermes with an existing RN app and was trying to exclude certain .so files based on build variants. What react native does and what has been discussed on several threads as well is that we should include libhermes-inspector.so and libhermes-executor-debug.so for debug variants and include libhermes-executor-release.so for the release variants.
I noticed that by excluding libhermes-inspector.so and libhermes-executor-debug.so on debug builds, and including just libhermes-executor-release.so, I was still able to open dev mode, attach a debugger and inspect elements.
Is this expected? My generated apk does not have libhermes-inspector.so and libhermes-executor-debug.so.
If yes, then what is the actual use of libhermes-inspector.so and libhermes-executor-debug.so?
Additionally, hermes-engine generates two files - hermes-debug.aar and hermes-release.aar which have libhermes.so. Here again, only including hermes-release.aar does not seem to affect my debug build. So what's the real purpose of hermes-debug.aar?
Would be helpful to understand what exactly each of these files are used for. Thanks!
There are two kinds of debugging support in React Native on Android.
-
you can enable remote debugging from the RN developer menu with "Debug JS Remotely", or more recently, using flipper. What this actually does is replace using the Hermes or JSC engine running on your device or simulator with using the JS engine which is part of Chrome running on your laptop or desktop development machine. Because this mechanism bypasses the embedded JS engine completely, it works regardless of which hermes libraries you include in your app. I suspect this is what you are doing when you say "open dev mode", which is why it works even with libhermes-executor-release.so.
-
You can connect to to Hermes debugger running on your device/emulator using the Chrome DevTools protocol, as described in https://reactnative.dev/docs/hermes#debugging-hermes-using-google-chromes-devtools. This depends on the inspector and debug executor libraries you mention in your OP. Currently, the only difference between hermes-debug and hermes-release is debugger support, but we may choose in the future to build with different options which trade off performance for easier debugging or better error handling.