Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.77] Android Old Architecture debug app freezes when Metro triggers reload #50274

Open
floydkim opened this issue Mar 26, 2025 · 12 comments
Open
Labels

Comments

@floydkim
Copy link

floydkim commented Mar 26, 2025

Description

The issue originates within the app as generated by the @react-native-community/cli template in versions 0.77.2 and 0.77.1
(Old Architecture, debug build. Occurs on both emulators and real devices.)

It did not occur in version 0.78.1.

After triggering a reload by pressing the ‘r’ key in Metro, the top status bar indicates that fast refresh is active when modifying the UI code, but the UI does not update.

Steps to reproduce

  1. Run a debug build.
  2. Trigger a reload by pressing the ‘r’ key on the Metro screen.
  3. Modify App.tsx to change the UI.

The issue may not be reproducible immediately.
But, repeatedly performing steps 2 and 3 often results in the UI not updating.

--

The reproducer repository consists of a template app generated using the command npx @react-native-community/cli@latest init RN772 --version 0.77.2.
No other modifications have been made except for setting it to use the Old Architecture.

React Native Version

0.77.2

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.3.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 1.35 GB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v20.11.1/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v20.11.1/bin/npm
  Watchman:
    version: 2025.02.17.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/floydkim/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.24978.46.2431.13208083
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /Users/floydkim/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.2
    wanted: 0.77.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

When this log appears after a reload, the issue occurs.

Trying to add a root view with an explicit id (11) already set. React Native uses the id field to track react tags and will overwrite this field. If that is fine, explicitly overwrite the id field to View.NO_ID before calling addRootView.

When scrolling the screen after the issue occurs, this log appears repeatedly.

Unhandled SoftException
com.facebook.react.bridge.ReactNoCrashSoftException: Cannot get UIManager because the context doesn't contain an active CatalystInstance.
	at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:82)
	at com.facebook.react.uimanager.UIManagerHelper.getEventDispatcher(UIManagerHelper.java:134)
	at com.facebook.react.uimanager.UIManagerHelper.getEventDispatcherForReactTag(UIManagerHelper.java:112)
	at com.facebook.react.views.scroll.ReactScrollViewHelper.emitScrollEvent(ReactScrollViewHelper.kt:126)
	at com.facebook.react.views.scroll.ReactScrollViewHelper.emitScrollEvent(ReactScrollViewHelper.kt:98)
	at com.facebook.react.views.scroll.ReactScrollViewHelper.emitScrollBeginDragEvent(ReactScrollViewHelper.kt:70)
	at com.facebook.react.views.scroll.ReactScrollView.handleInterceptedTouchEvent(ReactScrollView.java:453)
	at com.facebook.react.views.scroll.ReactScrollView.onInterceptTouchEvent(ReactScrollView.java:438)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2870)
	at android.widget.ScrollView.dispatchTouchEvent(ScrollView.java:858)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3022)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3022)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3022)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3022)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3022)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3022)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3022)
	at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:794)
	at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1967)
	at android.app.Activity.dispatchTouchEvent(Activity.java:4571)
	at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:70)
	at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:752)
	at android.view.View.dispatchPointerEvent(View.java:16498)
	at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:8676)
	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:8423)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7752)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7809)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7775)
	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:7978)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7783)
	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:8035)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7756)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7809)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7775)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7783)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7756)
	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:11343)
	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:11212)
	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:11168)
	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:11477)

Reproducer

https://github.com/floydkim/repro-react-native-0.77.2

Screenshots and Videos

react-native-0772-android-freeze-2.mov
@cipolleschi
Copy link
Contributor

Hi @floydkim, is this happening on Android only or also on iOS?

@floydkim
Copy link
Author

@cipolleschi
Hello. I just checked and it doesn't reproduce on iOS.

react-native-0772-ios-not-freezing.mov

@TomAtterton
Copy link
Contributor

This was working fine for me in 0.77.1 but recently upgraded to 0.77.2 and now metro won't even connect to my emulator not sure if this is related.

@floydkim
Copy link
Author

I thought it wasn't an issue with my local environment since I observed the same behavior on two different MacBook, but was I mistaken?

@cipolleschi
Copy link
Contributor

I just tried with a new app created using 0.77.2 and with an android emulator, and everything works on my side.

Have you tried with adb reverse as suggested here

@floydkim
Copy link
Author

@cipolleschi Thank you for your help.
The connection using adb reverse works correctly.

While testing again, I discovered something new.. It works fine on the Android 14 (SDK 35) emulator.
(A freeze issue does occur, but with a low probability.)

On the Android 15 emulator, the issue occurs within the first couple of attempts.

@cipolleschi
Copy link
Contributor

@cortinico do you have an Android 15 we can use for testing?

@cortinico
Copy link
Contributor

@cortinico do you have an Android 15 we can use for testing?

I just tested on a Android 15 emulator and I cannot reproduce at all @floydkim

Screen.Recording.2025-04-04.at.16.41.54.mov

@floydkim
Copy link
Author

floydkim commented Apr 5, 2025

@cortinico Thank you for looking into this issue.
Could you confirm that you have disabled the new architecture?

@cortinico
Copy link
Contributor

@cortinico Thank you for looking into this issue. Could you confirm that you have disabled the new architecture?

You're right I was on New Arch.
Yes it seems like fast refresh is broken on Old Arch.

We can look into it. In the meantime, what's the reason why you can't use NewArch?

@floydkim
Copy link
Author

floydkim commented Apr 8, 2025

@cortinico
If I start a new app, I’ll gladly adopt New Architecture from the beginning.

I’m maintaining an OTA update library, a fork of react-native-code-push.
I discovered this issue while testing compatibility with both the New and Old Architectures.

As you probably know, teams with long-standing React Native apps often manage to upgrade to RN 0.77+ but still run into issues enabling the New Architecture for various reasons.

I hope support for the Old Architecture continues a bit longer.
I know you and your team are putting a lot of effort into supporting everyone.
I really appreciate it.

@cortinico
Copy link
Contributor

Thanks for the context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants