From 5ee695ad8f41d7c9a92a83fa1f0acd227cdab7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20=C5=BBelawski?= Date: Thu, 12 Feb 2026 06:31:10 -0800 Subject: [PATCH] fix: missing symbols on prebuilt Android with hermesV1 disabled (#55400) Summary: Since HermesV1 is enabled by default in React Native 0.84, the prebuilt Android artifacts are compiled with the flag `HERMES_V1_ENABLED`. This results in dropping some inspector symbols, in my case `enableDebugging` and `disableDebugging` from `inspector-modern/chrome/Registration.cpp`. This is problematic, because even if the app sets `hermesV1Enabled=false` in `gradle.properties`, it's shipped with binaries compiled with `hermesV1Enabled=true`. This makes it so I'm expecting symbols that should be available when `HERMES_V1_ENABLED` macro isn't defined - but they aren't available. I don't know what other symbols could lead to compilation failures, maybe shipping a whole other binary would be a better idea. For the time being I made a simple fix that would provide fallback implementations instead of not generating them at all. ## Changelog: [ANDROID] [FIXED] - Provide symbol fallbacks for `inspector-modern/chrome/Registration.h` when HermesV1 is disabled. Pull Request resolved: https://github.com/facebook/react-native/pull/55400 Test Plan: I tested these changes (although in `Registration.h` file) in a project, not building from source, and they worked. Reviewed By: cipolleschi Differential Revision: D92964824 Pulled By: cortinico fbshipit-source-id: a87ceab6d25095062de200d1a08821dba379240d --- .../inspector-modern/chrome/Registration.cpp | 47 +++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp index d935ef0ad6d..3274cba4f59 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp @@ -8,10 +8,13 @@ #include "Registration.h" #include "ConnectionDemux.h" -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) +#if defined(HERMES_ENABLE_DEBUGGER) + +#include + +#if !defined(HERMES_V1_ENABLED) namespace facebook::hermes::inspector_modern::chrome { - namespace { ConnectionDemux& demux() { @@ -34,4 +37,42 @@ void disableDebugging(DebugSessionToken session) { } // namespace facebook::hermes::inspector_modern::chrome -#endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) +#else + +namespace facebook::hermes::inspector_modern { +class RuntimeAdapter { + // Backwards compatibility definition fallback for libraries that are compiled + // without `HERMES_V1_ENABLED` but are linked against React Native with + // `HERMES_V1_ENABLED` which doesn't provide this symbol. + public: + virtual ~RuntimeAdapter() = 0; + virtual HermesRuntime& getRuntime() = 0; + virtual void tickleJs(); +}; + +namespace chrome { + +using DebugSessionToken = int; + +DebugSessionToken enableDebugging( + std::unique_ptr, + const std::string&) { + // Backwards compatibility fallback for libraries that are compiled without + // `HERMES_V1_ENABLED` but are linked against React Native with + // `HERMES_V1_ENABLED` which doesn't provide this symbol. + return -1; +}; + +void disableDebugging(DebugSessionToken) { + // Backwards compatibility fallback for libraries that are compiled without + // `HERMES_V1_ENABLED` but are linked against React Native with + // `HERMES_V1_ENABLED` which doesn't provide this symbol. +} + +} // namespace chrome + +} // namespace facebook::hermes::inspector_modern + +#endif // !defined(HERMES_V1_ENABLED) + +#endif // defined(HERMES_ENABLE_DEBUGGER)