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 8.0] React Native not loading JS bundle #16126

Closed
kulmajaba opened this issue Sep 28, 2017 · 7 comments
Closed

[Android 8.0] React Native not loading JS bundle #16126

kulmajaba opened this issue Sep 28, 2017 · 7 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@kulmajaba
Copy link

Is this a bug report?

yes

Have you read the Contributing Guidelines?

yes

Environment

Environment:
OS: Windows 8.1
Node: 6.11.3
Yarn: 1.0.2
npm: 5.4.2
Watchman: Not Found
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react-native: 0.48.4 => 0.48.4
react: 16.0.0-alpha.12 => 16.0.0-alpha.12

Target Platform: Android Oreo (8.0)

Packager is running on port 8088

Steps to Reproduce

  1. Initialize a new RN project with react-native init
  2. Go to the project folder, start the development server and run react-native run-android

Expected Behavior

The app should install and load the JS bundle, displaying the welcome text.

Actual Behavior

The app installs correctly and starts, but doesn't load the JS bundle. Instead I get a white screen.

The packager is running on port 8088 so that gives an error on the first load. After running adb reverse I get the white screen. The packager does create a bundle.

Also tried with React Native 0.49.0-rc.6 and React 16.0.0-beta.5, same result. tested on Android emulator and Nexus 5X.

Logs from react-natice log-android (note: the last 2 lines are after running adb reverse tcp:8081 tcp:8088):

09-28 13:23:45.557 26358 26358 D ReactNative: ReactInstanceManager.ctor()
09-28 13:23:45.783 26358 26358 D ReactNative: ReactInstanceManager.createReactContextInBackground()
09-28 13:23:45.784 26358 26358 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundInner()
09-28 13:23:45.851 26358 26358 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundFromBundleLoader()
09-28 13:23:45.851 26358 26358 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
09-28 13:23:45.852 26358 26358 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
09-28 13:23:45.887 26358 26417 D ReactNative: ReactInstanceManager.createReactContext()
09-28 13:23:46.138 26358 26417 D ReactNative: Initializing React Xplat Bridge.
09-28 13:23:46.140 26358 26417 D ReactNative: Initializing React Xplat Bridge before initializeBridge
09-28 13:23:46.161 26358 26417 D ReactNative: Initializing React Xplat Bridge after initializeBridge
09-28 13:23:46.161 26358 26417 D ReactNative: CatalystInstanceImpl.runJSBundle()
09-28 13:24:10.108 26358 26358 D ReactNative: ReactInstanceManager.onJSBundleLoadedFromServer()
09-28 13:24:10.114 26358 26358 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
@laclance
Copy link

+1

@kulmajaba
Copy link
Author

Update:

I reproduced the same issue with Android 7.1.1 emulator on Windows 8.1.

Switched to a macOS 10.11.6 system, could not reproduce with the packager running on port 8081. The initial project loaded correctly on my Android 8.0 device.

Tried again on the macOS system, this time using react-native start --port 8088. Repro'd the issue, again the packager bundles the JS but it is not loaded to the device.

This seems to be a problem with the packager custom port or possibly adb reverse, though the packager does rebundle JS when changing the code, saving and hitting Reload from the device.

Going to close this issue and open a new one with a more accurate description.

@kulmajaba
Copy link
Author

kulmajaba commented Sep 29, 2017

Seems like the issue came from local-cli\runAndroid\runAndroid.js, line 62:

const adbArgs = ['reverse', 'tcp:8081', 'tcp:8081'];

Changing the line to const adbArgs = ['reverse', 'tcp:8081', 'tcp:8088']; fixed the issue.

This issue is properly fixed in 898790d and the commit is picked to 0.49.0 release candidates. With 0.49 you need to run react-native run-android --port 8088.

@pacozaa
Copy link

pacozaa commented Mar 28, 2018

@kulmajaba where is your new issue? I am facing the same problem

@kulmajaba
Copy link
Author

@pacozaa I didn't open a new issue because as I stated in my last comment, this particular issue was already fixed in a commit that was in RC when I was testing this.

Are you sure you are facing an issue specifically related to running the RN packager on a custom port? If you are, please post more information on the issue (version numbers, logs etc.). If not, please see if there are any open issues specifically about your problem or any questions in Stackoverflow.

@aesmon
Copy link

aesmon commented Sep 17, 2018

Same issue although not related to packager - when bundle is compiled the JS is not loaded by the app. Output is the same.

@kulmajaba
Copy link
Author

@aesmon Please note that this issue is closed as solved and almost a year old, most likely your problem is caused by something different.

Consider opening a new issue if you are certain that your situation is caused by React Native.

@facebook facebook locked as resolved and limited conversation to collaborators Sep 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants