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

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)

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 13
  • Comments: 17 (2 by maintainers)

Commits related to this issue

Most upvoted comments

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

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: https://github.com/react-native-community/discussions-and-proposals/pull/759#discussion_r1476513390).

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

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

Same:

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

I am having the same problem!

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

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.

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

Same for me and my team on:

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