-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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][Redbox Message] Misleading redbox message when starting app for the first time without packager running. #4739
Comments
Hey qbig, thanks for reporting this issue! React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
|
private void recreateReactContextInBackgroundInner() {
UiThreadUtil.assertOnUiThread();
if (mUseDeveloperSupport && mJSMainModuleName != null) {
if (mDevSupportManager.hasUpToDateJSBundleInCache()) {
// If there is a up-to-date bundle downloaded from server, always use that
onJSBundleLoadedFromServer();
} else if (mJSBundleFile == null) {
mDevSupportManager.handleReloadJS();
} else {
mDevSupportManager.isPackagerRunning(
new DevServerHelper.PackagerStatusCallback() {
@Override
public void onPackagerStatusFetched(final boolean packagerIsRunning) {
UiThreadUtil.runOnUiThread(
new Runnable() {
@Override
public void run() {
if (packagerIsRunning) {
mDevSupportManager.handleReloadJS();
} else {
recreateReactContextInBackgroundFromBundleFile(); // <-- First time run would end up here
}
}
});
}
});
}
return;
}
recreateReactContextInBackgroundFromBundleFile();
} if reload is clicked,
would get executed and show the correct the redbox info. Seems this is the problem ?
|
Also, why not spell it out to new users "Please run 'react-native start' in the root of your project and make sure your device is connected"? We all know people hate reading long intros ("what is the developmentserver?") and often just starts playing around with new stuff :). Maybe even mention "adb reverse tcp:8081 tcp:8081" if android is detected.. not sure about this one. |
is there anyway to solve this problem? |
PRs are welcome for a better error message. |
The root of the issue is that we are calling 'runJSBundle' when there isn't one. And the native cpp implementation throw back the wrong error message. Can fix this in cpp land. But I was struggling getting jni debugging working. Or alternatively, we can check the validity of the bundle before calling 'runJSBundle', which is what I tried in #4738 |
Can we simply replace both error messages with the message iOS has? IMHO "Can't find variable __fbBatchedBridge" is never useful to anyone. If you can't replace the message in C++, can you detect that exception reliably and throw one with a better message? The "Unable to download JS bundle" message is not very good either. Replacing that with the clear message should be trivial. Thanks so much for working on this, the cryptic message has been bothering many people for a long time. |
We used to have a better error message for this case. This looks like a regression then. But yeah, the one on iOS is even better, so let's go with that |
As of 0.18.0rc, the |
Yeah this is pretty bad. Anyone up for sending a fix? |
Not sure if this is the correct way, but here is a PR - #5235 |
@mkonicek Can you cc someone who has more context on this? |
Is this still happening on 0.18? |
@foghina Yes, happens on master! |
Just wanted to chime in here. #5235 improved the message related to the packager not running. However, the
Any suggestions for making sure these two cases are covered as well? |
Hi there! This issue is being closed because it has been inactive for a while. But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/androidredbox-message-misleading-redbox-message-when-starting-app-for-the-first-time-without-packager-running ProductPains helps the community prioritize the most important issues thanks to its voting feature. Also, if this issue is a bug, please consider sending a pull request with a fix. |
The first time you run(accidentally) RN app without the packager running, the redbox would show the above message. Only after clicking 'reload' the info below would be shown, which is a lot more helpful?
I am not sure but should we use the second redbox info for both cases ?
The text was updated successfully, but these errors were encountered: