facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.23k stars 24.22k forks source link

App Crashes on Home Screen Launch but Works When Opened from Play Store After New Architecture Update #45890

Closed bahadiraraz closed 1 month ago

bahadiraraz commented 1 month ago

Description

When using the new architecture (Fabric & TurboModules) in React Native, the application crashes for some users when launched from the Android home screen. Interestingly, the app works fine when launched directly from the Play Store. This issue started occurring after switching to the new architecture, and despite trying various troubleshooting steps such as clearing app and Play Store data, and rebooting the phone, the issue persists. It's unclear whether the problem is related to Expo or React Native.

In an attempt to resolve the issue, we rolled back to the old architecture. However, the users who were experiencing the crashes still face the same issue. They can only launch the app successfully by going through the Play Store, not from the home screen.

Additionally, this crash has been reported by multiple users, indicating it is a widespread issue.

I would also like to note that I have not encountered this issue in simulation or during product builds.

Below, I have attached videos demonstrating the issue:

Device Information

Here are the details of the devices used in the reports:

Device 1

Device 2

Steps to reproduce

  1. Open the application by searching for its name in the Play Store and tapping "Open". Notice that the app works fine.
  2. Return to the Android home screen.
  3. Tap on the app icon on the home screen to launch it.
  4. Notice the crash.

React Native Version

0.74.3

Affected Platforms

Runtime - Android

Areas

TurboModule - The New Native Module System, Bridgeless - The New Initialization Flow

Output of npx react-native info

:
  OS: macOS 14.3.1
  CPU: (8) arm64 Apple M1
  Memory: 141.77 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 10.2.4
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.06.17.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.3
    wanted: 0.74.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

.facebook.react.common.JavascriptException: Error: Exception in HostObject::get
for prop 'NativeUnimoduleProxy':
java.lang.IllegalArgumentException: Could not put
'class android.os.UserHandle' to WritableMap, js
engine: hermes, stack:
anonymous@1:991096
loadModuleImplementation@1:108272
guardedLoadModule@1:107820
metroRequire@1:107442
anonymous@1:987750
loadModuleImplementation@1:108272
guardedLoadModule@1:107820
metroRequire@1:107442
anonymous@1:985839
loadModuleImplementation@1:108272
guardedLoadModule@1:107820
metroRequire@1:107442
anonymous@1:114464
loadModuleImplementation@1:108272
guardedLoadModule@1:107820
metroRequire@1:107442
anonymous@1:114347
loadModuleImplementation@1:108272
guardedLoadModule@1:107777
metroRequire@1:107442
global@1:106983

at
com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:65)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:146)
at com.facebook.jni.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:233)
at java.lang.Thread.run(Thread.java:1012)

Reproducer

https://play.google.com/store/apps/details?id=com.sorsorui

Screenshots and Videos

https://github.com/user-attachments/assets/c7610e65-39ff-45ac-bafd-f38af6131637

https://github.com/user-attachments/assets/cb3c4efc-703b-43b6-a59f-b5b2436e85b5

react-native-bot commented 1 month ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.74.4. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
react-native-bot commented 1 month ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
react-native-bot commented 1 month ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
react-native-bot commented 1 month ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
bahadiraraz commented 1 month ago

https://github.com/expo/expo/issues/30807

bahadiraraz commented 1 month ago

Issue Resolution: Update expo-notifications to Version 0.28.15