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

[SDK 49][0.72.7][Android] expo-dev-client causes NullPointerException in DevLoadingModule during hot-reload #25520

Closed
thespacemanatee opened this issue Nov 22, 2023 · 18 comments

Comments

@thespacemanatee
Copy link
Contributor

thespacemanatee commented Nov 22, 2023

Summary

After bumping react native to 0.72.7, saving the project will immediately crash the Android app.

It's definitely related to this commit. The introduction of DevLoadingModule does not play well with expo-dev-client.

Managed or bare workflow?

bare

What platform(s) does this occur on?

Android

Package versions

"dependencies": {
  "expo": "~49.0.19",
  "expo-dev-client": "~2.4.12",
  "expo-status-bar": "~1.7.1",
  "react": "18.2.0",
  "react-native": "0.72.7",
  "expo-splash-screen": "~0.22.0"
}

Environment

expo-env-info 1.0.5 environment info:
  System:
    OS: macOS 14.1.1
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.15.0 - ~/.asdf/installs/nodejs/16.15.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.5.5 - ~/.asdf/plugins/nodejs/shims/npm
    Watchman: 2023.06.26.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /Users/thespacemanatee/.asdf/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
    Android SDK:
      API Levels: 23, 26, 29, 30, 31, 33, 34
      Build Tools: 26.0.3, 29.0.2, 30.0.3, 31.0.0, 33.0.0, 33.0.1, 33.0.2, 34.0.0, 34.0.0
      System Images: android-24 | Google APIs ARM 64 v8a, android-26 | Google APIs ARM 64 v8a, android-26 | Google APIs Intel x86_64 Atom, android-26 | Google Play Intel x86 Atom, android-29 | Google Play ARM 64 v8a, android-33 | Desktop ARM 64 v8a, android-33 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a, android-34 | Google Play ARM 64 v8a
  IDEs:
    Xcode: 15.0/15A240d - /usr/bin/xcodebuild
  npmPackages:
    expo: ~49.0.19 => 49.0.20 
    react: 18.2.0 => 18.2.0 
    react-native: 0.72.7 => 0.72.7 
  npmGlobalPackages:
    eas-cli: 5.9.1
  Expo Workflow: bare

Reproducible demo

https://github.com/thespacemanatee/dev_loading_module_crash_repro

  • Run the project and save any changes
  • Crash

Please checkout branch without-expo-dev-client to see that hot reloading works without expo-dev-client

Stacktrace (if a crash is involved)

 ERROR  Your app just crashed. See the error below.
java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.devsupport.interfaces.DevLoadingViewManager.showMessage(java.lang.String)' on a null object reference
  com.facebook.react.modules.devloading.DevLoadingModule$1.run(DevLoadingModule.java:49)
  android.os.Handler.handleCallback(Handler.java:958)
  android.os.Handler.dispatchMessage(Handler.java:99)
  android.os.Looper.loopOnce(Looper.java:205)
  android.os.Looper.loop(Looper.java:294)
  android.app.ActivityThread.main(ActivityThread.java:8177)
  java.lang.reflect.Method.invoke(Native Method)
  com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Nov 22, 2023
@thespacemanatee thespacemanatee changed the title [SDK 49][0.72.7][Android] java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.devsupport.interfaces.DevLoadingViewManager.showMessage(java.lang.String)' on a null object reference [SDK 49][0.72.7][Android] expo-dev-client causes NullPointerException in DevLoadingModule Nov 22, 2023
@thespacemanatee thespacemanatee changed the title [SDK 49][0.72.7][Android] expo-dev-client causes NullPointerException in DevLoadingModule [SDK 49][0.72.7][Android] expo-dev-client causes NullPointerException in DevLoadingModule during hot-reload Nov 22, 2023
@xseignard
Copy link

I confirm it is happening too with expo@49 and react-native@0.72.7

@T-Damer
Copy link

T-Damer commented Nov 23, 2023

Same for me and my team on:

    "expo": "^49.0.20",
    "react-native": "0.72.7",

@Mitdd9707
Copy link

I am having the same problem!

"expo": "^49.0.14", "react-native": "0.72.7"

@Macpire
Copy link

Macpire commented Nov 24, 2023

Same:

"expo": "^49.0.20", 
"expo-dev-client": "~2.4.12",
"react-native": "0.72.7"

@lucasbasquerotto
Copy link

lucasbasquerotto commented Nov 24, 2023

This happens with me too, although expo-doctor suggests to use 0.72.6 in the eas build:

Some dependencies are incompatible with the installed expo version:
  react-native@0.72.7 - expected version: 0.72.6

Weird that this warning doesn't show when running expo-doctor (1.1.3) locally.

@jeferagudeloc
Copy link

jeferagudeloc commented Nov 25, 2023

Hi guys,

Hi, I had the same problem, I just downgrade this dependencies to:

  "expo-dev-client": "^2.4.11",
  "react-native": "0.72.5",

And that solves the problem

@RohovDmytro
Copy link

RohovDmytro commented Nov 29, 2023

Same with expo@49.0.21

@AntQwanlity
Copy link

Same issue here, simply reverting to react-native 0.72.6 fixes it

@CostasCF
Copy link

CostasCF commented Dec 2, 2023

I can confirm this is happening to my team also.

@raulzilla
Copy link

raulzilla commented Dec 7, 2023

I run the command npx -y expo-doctor and accepted the updates requested by the command, in this case it was a downgrade of react-native-gesture-handler from version 2.14.0 to 2.12.0 and after generating a new build of the app, it worked well for me

@trajano
Copy link
Contributor

trajano commented Dec 12, 2023

Perhaps the module should start considering use of the PanResponder rather than RNGH

@qizf7
Copy link

qizf7 commented Dec 28, 2023

Same problem!
"expo-dev-client": "~2.4.12",
"react-native": "^0.72.6",
"expo": "^49.0.21",

@luicfrr
Copy link

luicfrr commented Jan 12, 2024

I'm using expo in 49.0.21 version. I saw this problem right after updating all app's dependencies.

After running npx expo install --check a lot of dependencies were downgraded to expo's expected versions including:
react-native from 0.72.9 to 0.72.6
react-native-gesture-handler from 2.14.0 to 2.12.0

The error stoped after this.

@techgerm
Copy link

techgerm commented Jan 25, 2024

We're developing our expo app in an Nx monorepo along side other bare bones react native apps and this crash started happening once we upgraded react-native from 0.72.6 to 0.72.9. Worth noting that we're still on react-native-gesture-handler: 2.12.0 though.

For us it's not feasible to downgrade back to 0.72.6 but it's making android development on our expo app unbearable.
Is there any status update on when this could be fixed?

@brentvatne
Copy link
Member

hi there!

this issue was caused by a regression in react-native in the 0.72.7 release. the react-native APIs that expo-dev-client uses are not always stable and we're working with Meta on improving that (see: react-native-community/discussions-and-proposals#759 (comment)).

we'll investigate what it would take to work around this regression.

@expo-bot
Copy link
Collaborator

expo-bot commented Feb 5, 2024

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@github-actions github-actions bot removed the needs review Issue is ready to be reviewed by a maintainer label Feb 5, 2024
gabrieldonadel added a commit that referenced this issue Feb 9, 2024
# Why

Update react-native to the latest 0.72 patch for SDK 49 

Related to #25520
Closes ENG-11348

# How

- update package versions
  - `react-native 0.73.6 -> 0.73.10`   

## Follow-up 

In order to fix #25520 we will need
to disable the `DevLoadingModule` on Android when using dev-client.
That's because in 0.72.7 ,`DevLoadingModule` checks specifically for an
instance of `BridgeDevSupportManager` to initialize
`mDevLoadingViewManager` and given that DevLauncher uses a custom bridge
support manager this check fails and `mDevLoadingViewManager` is never
initialized.

Because of that, I'll be opening a separate PR specific for this
dev-launcher fix.


# Test Plan

- bare-expo ios / android 
- fabric ios / android

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
gabrieldonadel added a commit that referenced this issue Feb 9, 2024
…tation (#27010)

# Why

Closes #25520
Closes ENG-11348

In react-native 0.72.7 the `DevLoadingModule` module was enabled but the
logic used in its constructor checks specifically for an instance of
`BridgeDevSupportManager` to initialize `mDevLoadingViewManager` and
given that DevLauncher uses a custom bridge support manager this check
fails and `mDevLoadingViewManager` is never initialized, causing a crash
when the HMR client invokes it from the JS side.

# How

Swap out react-native DevLoadingModule with a custom implementation that
uses the correct checks for initializing
`mDevLoadingViewManager` 

# Test Plan

Run dev-client through BareExpo and ensure hot reloading works 

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
lukmccall pushed a commit that referenced this issue Feb 19, 2024
…se of auto setup enabled (#27068)

# Why

I see the following crash in a build that has dev client disabled via `enableAutoSetup = false` - #25520
<!--
Please describe the motivation for this PR, and link to relevant GitHub issues, forums posts, or feature requests.
-->

# How

<!--
How did you build this feature or fix this bug and why?
-->

I saw DevLauncherDevSupportManager being set via reactnativehosthandler, even though I have disabled dev client.

# Test Plan

Try out bare expo with `enableAutoSetup` false. Then edit a file to trigger HMR.
I should not see following crash: #25520
<!--
Please describe how you tested this change and how a reviewer could reproduce your test, especially if this PR does not include automated tests! If possible, please also provide terminal output and/or screenshots demonstrating your test/reproduction.
-->

# Checklist

<!--
Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
aleqsio pushed a commit that referenced this issue Feb 22, 2024
…se of auto setup enabled (#27068)

# Why

I see the following crash in a build that has dev client disabled via `enableAutoSetup = false` - #25520
<!--
Please describe the motivation for this PR, and link to relevant GitHub issues, forums posts, or feature requests.
-->

# How

<!--
How did you build this feature or fix this bug and why?
-->

I saw DevLauncherDevSupportManager being set via reactnativehosthandler, even though I have disabled dev client.

# Test Plan

Try out bare expo with `enableAutoSetup` false. Then edit a file to trigger HMR.
I should not see following crash: #25520
<!--
Please describe how you tested this change and how a reviewer could reproduce your test, especially if this PR does not include automated tests! If possible, please also provide terminal output and/or screenshots demonstrating your test/reproduction.
-->

# Checklist

<!--
Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
@Mahmoudkhoder01
Copy link

any solutions here? my dependecies:
"expo": "~49.0.15", "expo-dev-client": "~2.4.12", "react-native": "0.72.10", "react-native-gesture-handler": "~2.12.0",

@viniciuspetrachin
Copy link

The solution for me was in package.json:

Expo SDK: "expo": "~49.0.13"
React Native SDK: "react-native": "0.72.6"

I also removed the option for automatic updates, fixing the version at 0.72.6. This really solved the issue, as mentioned in the previous comment.

Before applying this solution, I was encountering the following error:

java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.devsupport.interfaces.DevLoadingViewManager.showMessage(java.lang.String)' on a null object reference

In Crashlytics, the logged error was:

com.facebook.react.modules.devloading.DevLoadingModule$1.run (DevLoadingModule.java:49)
android.os.Handler.handleCallback (Handler.java:958)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loopOnce (Looper.java:205)
android.os.Looper.loop (Looper.java:294)
android.app.ActivityThread.main (ActivityThread.java:8177)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:552)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:971)

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

No branches or pull requests