react-native: react-native init app is crashing at startup
Environment
➜ test58 react-native info
React Native Environment Info: System: OS: macOS 10.14.2 CPU: (4) x64 Intel® Core™ i5-4278U CPU @ 2.60GHz Memory: 662.13 MB / 8.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 8.10.0 - ~/.nvm/versions/node/v8.10.0/bin/node Yarn: 1.12.3 - /usr/local/bin/yarn npm: 6.5.0 - ~/.nvm/versions/node/v8.10.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1 Android SDK: API Levels: 17, 19, 20, 21, 23, 24, 25, 26, 27, 28 Build Tools: 23.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.2, 27.0.3, 28.0.3 System Images: a…-23 | Intel x86 Atom, a… | Intel x86 Atom_64, a…google_apis | Google APIs Intel x86 Atom Sys…, a…gle_apis | Google APIs Intel x86 Atom_64 … IDEs: Android Studio: 3.2 AI-181.5540.7.32.5056338 Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmPackages: react: 16.6.3 => 16.6.3 react-native: 0.58.3 => 0.58.3 npmGlobalPackages: react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7
Description
I wanted to test newly release 0.58 so just created an new emtpy app using react-native init
and run it. The app crashes at start up and in the log I see
01-30 20:01:47.104 8410 8454 E AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
01-30 20:01:47.104 8410 8454 E AndroidRuntime: Process: com.test58, PID: 8410
01-30 20:01:47.104 8410 8454 E AndroidRuntime: java.lang.IllegalStateException: Expected a string but was BEGIN_ARRAY
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at android.util.JsonReader.nextString(JsonReader.java:408)
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at com.facebook.react.devsupport.BundleDeltaClient$BundleDeltaJavaClient.processDelta(BundleDeltaClient.java:103)
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at com.facebook.react.devsupport.BundleDeltaClient.processDelta(BundleDeltaClient.java:71)
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at com.facebook.react.devsupport.BundleDownloader.processBundleResult(BundleDownloader.java:314)
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at com.facebook.react.devsupport.BundleDownloader.access$200(BundleDownloader.java:37)
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at com.facebook.react.devsupport.BundleDownloader$1.onResponse(BundleDownloader.java:174)
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
01-30 20:01:47.104 8410 8454 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764)
01-30 20:01:47.107 9305 9454 W ActivityManager: Force finishing activity com.test58/.MainActivity
01-30 20:01:47.115 9305 9336 I ActivityManager: Showing crash dialog for package com.test58 u0
Reproducible Demo
- react-native init test58
- cd test58
- react-native run-android
Any idea what is wrong here ? The new release ? My environment ?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (1 by maintainers)
I am seeing this issue on RN 0.59.2 I freshly installed Android Studio 3.3.2 along with sdk, emulator etc. I run react-native init, and run-android and get the FATAL EXCEPTION: OkHttp Dispatcher error.
i restarted my laptop and it worked 😅
hey, try to follow these steps: https://medium.com/@adityasingh_32512/solved-unable-to-load-script-from-assets-index-android-bundle-bdc5e3a3d5ff It worked to me.
(sorry if isn’t allowed to share links here)
Maybe you have two projects, and start nodejs server in wrong folder for example.
Solved when I moved from 0.59.0-rc.0 to 0.59.8
@rfernandotimedev & @hramos - I followed the above article that basically tell me to create the bundle and then to run the app again via
react-native run android
but it did not help. Same crash with the sameOkHttp Dispatcher
error. What bother me here is that I am running a vanilla, out-of-the-box react-native app and would expect that initial flow to come smoothly. I actually have issues upgrading from 0.53 my real app and wanted first to see how a new fresh 0.58 app will behave…