You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android: generated ReactNativeHostManager loads React Native twice and crashes (Feature flags cannot be overridden more than once) #492
The ReactNativeHostManager.kt that npm create @callstack/react-native-brownfield generates for a React Native CLI project crashes when the native app starts React Native:
java.lang.RuntimeException: Feature flags cannot be overridden more than once
at com.facebook.react.internal.featureflags.ReactNativeFeatureFlags.override(ReactNativeFeatureFlags.kt:558)
at com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load(DefaultNewArchitectureEntryPoint.kt:101)
at com.callstack.reactnativebrownfield.ReactNativeBrownfield$Companion.loadNativeLibsInternal(ReactNativeBrownfield.kt:49)
at com.callstack.reactnativebrownfield.ReactNativeBrownfield$Companion.initialize(ReactNativeBrownfield.kt:66)
at com.rnapp.ReactNativeHostManager.initialize(ReactNativeHostManager.kt:28)
Cause: the template (ReactNativeHostManager.vanilla.kt) calls loadReactNative(application) and then ReactNativeBrownfield.initialize(application, reactHost, ...). Both run DefaultNewArchitectureEntryPoint.load(), which sets React Native's feature flags, so the second call throws. The nativeLibsLoaded guard in ReactNativeBrownfield.kt can't see the earlier loadReactNative call.
Repro:https://github.com/gronxb/react-native-brownfield-492-repro. It has the scaffold output and a minimal native Android app that starts React Native from a button. The README has the steps, and the comment below has videos of the crash and the fix.
Fix: remove loadReactNative(application) and pass the React host as a factory, as the Expo template (ReactNativeHostManager.post55.kt) already does:
Removing only loadReactNative is not enough. The template builds the host (val reactHost by lazy { getDefaultReactHost(...) }) as an argument to the deprecated initialize(application, reactHost, ...) overload, so it is built before initialize loads the native libraries, and the app then fails with SoLoader.init() not yet called. loadReactNative also turns on edge-to-edge when IS_EDGE_TO_EDGE_ENABLED is set, so a template fix should keep that part.
crashes with Feature flags cannot be overridden more than once
issue-fix (only loadReactNative removed, the fix this issue first suggested)
crashes with SoLoader.init() not yet called
working-fix (factory overload)
starts and renders the React Native screen
The host app opens on a native screen and starts React Native from its "Open React Native" button.
As generated (main): the app crashes when the native screen starts React Native.
crash.mp4
With the factory overload (working-fix): React Native renders below the native header.
fixed.mp4
The README has the steps, versions, and both stack traces. I tested with create-react-native-brownfield 5.3.0 and React Native 0.85.2 on an Android emulator (API 37).
Activity
gronxb commentedon Oct 14, 2026
I put together a repro for this: https://github.com/gronxb/react-native-brownfield-492-repro
main(template as generated)Feature flags cannot be overridden more than onceissue-fix(onlyloadReactNativeremoved, the fix this issue first suggested)SoLoader.init() not yet calledworking-fix(factory overload)The host app opens on a native screen and starts React Native from its "Open React Native" button.
As generated (
main): the app crashes when the native screen starts React Native.crash.mp4
With the factory overload (
working-fix): React Native renders below the native header.fixed.mp4
The README has the steps, versions, and both stack traces. I tested with create-react-native-brownfield 5.3.0 and React Native 0.85.2 on an Android emulator (API 37).