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

android crash new arch #47535

Closed
philipheinser opened this issue Nov 10, 2024 · 8 comments
Closed

android crash new arch #47535

philipheinser opened this issue Nov 10, 2024 · 8 comments
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications.

Comments

@philipheinser
Copy link
Contributor

Description

Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'com.facebook.react.interfaces.fabric.ReactSurface com.facebook.react.ReactHost.createSurface(android.content.Context, java.lang.String, android.os.Bundle)' on a null object reference
    com.facebook.react.ReactDelegate.loadApp(ReactDelegate.java:292)
    com.facebook.react.ReactActivityDelegate.loadApp(ReactActivityDelegate.java:137)
    com.facebook.react.ReactActivityDelegate.onCreate(ReactActivityDelegate.java:132)
    com.facebook.react.ReactActivity.onCreate(ReactActivity.java:47)

Steps to reproduce

after update run on android

React Native Version

0.76.1

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 15.2
  CPU: (12) arm64 Apple M2 Pro
  Memory: 110.81 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.1.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.11.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12550806
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.1.1
    wanted: 15.1.1
  react:
    installed: 18.3.1
    wanted: ^18.3.1
  react-native:
    installed: 0.76.1
    wanted: ^0.76.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: false
  newArchEnabled: true

Stacktrace or Logs

Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'com.facebook.react.interfaces.fabric.ReactSurface com.facebook.react.ReactHost.createSurface(android.content.Context, java.lang.String, android.os.Bundle)' on a null object reference
    com.facebook.react.ReactDelegate.loadApp(ReactDelegate.java:292)
    com.facebook.react.ReactActivityDelegate.loadApp(ReactActivityDelegate.java:137)
    com.facebook.react.ReactActivityDelegate.onCreate(ReactActivityDelegate.java:132)
    com.facebook.react.ReactActivity.onCreate(ReactActivity.java:47)

Reproducer

https://github.com/react-native-community/reproducer-react-native

Screenshots and Videos

No response

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications. labels Nov 10, 2024
@react-native-bot
Copy link
Collaborator

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

@Eralyne
Copy link

Eralyne commented Nov 20, 2024

Hey, I'm facing this same issue and struggling to find the source of the problem. What solution did you find?

@philipheinser
Copy link
Contributor Author

@Eralyne Disable new arch. Or disable the thorax party analytics plugin we were using. Both not really a solution.

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Nov 20, 2024
@Eralyne
Copy link

Eralyne commented Nov 20, 2024

@philipheinser That sucks to hear, thanks for the quick reply.

@VimukthiShohan
Copy link

VimukthiShohan commented Nov 27, 2024

Same issue.

I have disabled newArch from android (java) for now. But is there a proper solution for those who are updating react-native from older versions?

@aleksnied
Copy link

aleksnied commented Jan 7, 2025

hi all, I ran into the same issue upgrading from an older version to 0.76. The fix for me was a missing override in my MainApplication.kt that was not needed there previously. After I added this in the app now launches fine. Easy to miss, previously only reactNativeHost override was required.

override val reactHost: ReactHost get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost)

@Ryan82012993
Copy link

hi all, I ran into the same issue upgrading from an older version to 0.76. The fix for me was a missing override in my MainApplication.kt that was not needed there previously. After I added this in the app now launches fine. Easy to miss, previously only reactNativeHost override was required.

override val reactHost: ReactHost get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost)

Where did the ReactNativeHostWrapper come from?

@tekinalper
Copy link

I'm facing with this as well. Any details?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications.
Projects
None yet
Development

No branches or pull requests

7 participants