Repository navigation
Android: SurfaceMountingManager loses view registry entries on 0.87 with androidx.collection 1.4.2 (MutableIntObjectMap corruption fixed in androidx 1.4.3) #58388
Description
Description
Since 0.87.0 SurfaceMountingManager keeps its tag to ViewState registry in androidx.collection.MutableIntObjectMap (#56646, feature flag removed in #57228).
androidx.collection 1.4.3 fixed "a corruption that could happen in ScatterMap, ScatterSet, and their primitive variants" (b/352560465). React Native pins 1.4.0 in https://github.com/react/react-native/blob/main/packages/react-native/gradle/libs.versions.toml; a fresh 0.87.1 app resolves 1.4.2 through androidx.core and androidx.window.
With 1.4.2, entries for views RN created and never deleted become unreachable while the map's size still counts them. RN then logs Unable to find viewState for tag N for <op> and skips that instruction: prop and layout updates of the view, deleteView of it, and inserts or removals of children that look it up as the parent. A stale view can stay on screen. Plain Views are enough; no third-party native code is involved. In libraries like reanimated, where pontetially layout animations could replay removals in bursts, hit this issue faster.
Steps to reproduce
- Clone the reproducer,
cd ReproducerApp && yarn && yarn android. adb logcat | grep "Unable to find viewState".- Press "Run 40 rounds". Each round unmounts 60 seeded-random plain
Views and mounts up to 70, capped at 500 views. - Expected: no such log lines. Observed: 91 lines on 45 distinct tags over two runs on a Pixel 9a, Android 16, plus a stale box drawn over a live one.
- Fix check:
implementation("androidx.collection:collection:1.4.4")inandroid/app/build.gradle. With the pin, the same screen inside a larger app logged nothing over 120 rounds on the same device.
React Native Version
0.87.1, also seen on 0.87.0. (0.86 source still uses ConcurrentHashMap for this registry)
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: macOS 26.6.2
CPU: (11) arm64 Apple M3 Pro
Memory: 136.27 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 24.16.0
path: /Users/oskarpawica/.nvm/versions/node/v24.16.0/bin/node
Yarn:
version: 4.13.0
path: /Users/oskarpawica/.nvm/versions/node/v24.16.0/bin/yarn
npm:
version: 11.13.0
path: /Users/oskarpawica/.nvm/versions/node/v24.16.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.5
- iOS 26.5
- macOS 26.5
- tvOS 26.5
- visionOS 26.5
- watchOS 26.5
Android SDK:
API Levels:
- "34"
- "36"
- "36"
- "37"
Build Tools:
- 33.0.1
- 35.0.0
- 36.0.0
- 36.1.0
- 37.0.0
System Images:
- android-36.1 | Google Play ARM 64 v8a
- android-36 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2025.3 AI-253.29346.138.2531.14876573
Xcode:
version: 26.6/17F113
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.18
path: /opt/homebrew/Cellar/openjdk@17/17.0.18/libexec/openjdk.jdk/Contents/Home/bin/javac
Ruby:
version: 3.3.7
path: /Users/oskarpawica/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.2.0
wanted: 20.2.0
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.87.1
wanted: 0.87.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
E/unknown:SurfaceMountingManager:MissingViewState: com.facebook.react.bridge.ReactNoCrashSoftException: Unable to find viewState for tag 8608 for updateLayout
E/unknown:SurfaceMountingManager:MissingViewState: com.facebook.react.bridge.ReactNoCrashSoftException: Unable to find viewState for tag 9910 for updateProps
E/unknown:SurfaceMountingManager:MissingViewState: com.facebook.react.bridge.ReactNoCrashSoftException: Unable to find viewState for tag 10136 for deleteView
MANDATORY Reproducer
https://github.com/pawicao/rn-android-view-registry-corruption
Screenshots and Videos
No response
Activity
fix(android): bump androidx.collection to 1.4.4 to avoid MutableIntOb…
fix(android): bump androidx.collection to 1.4.4 to avoid MutableIntOb…
fix(android): bump androidx.collection to 1.4.4 to avoid MutableIntOb…
joshuapinter commentedon Oct 15, 2026
Data point from a production Android app (New Architecture, Hermes) that just moved 0.86.3 → 0.87.1: this can be fatal, not only a stale view.
androidx.collection1.4.2 (pulled up byandroidx.core1.17.0 /androidx.window1.5.1 over react-android 0.87.1's declared 1.4.0).Unable to find viewState for tag N for <removeViewAt|deleteView|updateProps|updateLayout|updateState>soft exceptions; the same suite on 0.86.3 logs none.Unable to find viewState for tag: [48318] for addViewAt, then 1 ms laterIllegalStateException: addViewAt: failed to insert view [48336] into parent [48338] at index 1caused byIndexOutOfBoundsException: index=1 count=0(SurfaceMountingManager.addViewAt→ReactClippingViewManager.addView, plainaddViewbranch), i.e. the dropped sibling left the parent with no children and the next insert at index 1 threw →FATAL EXCEPTION: main. It happened during anavigation.replaceon a stack screen. The registry dump printed after the crash still listed tag 48318, so the entry existed while the keyed lookup missed it.updateProps/updateLayout/setTextAndSelectionfor aTextInputleft it disabled and laid out outside its parent (invisible to accessibility) while JS believed it was editable.androidx.collection:collection:1.4.4(andcollection-ktx) in the app module: 0 soft exceptions in an A/B of the same scenario on the same device (5 → 0), and neither failure reproduced since.Since
0.87-stablestill pins 1.4.0 inlibs.versions.toml, a 0.87.x pick of #58389 would spare other 0.87 apps this; happy to open the pick request on react-native-releases if that helps.