可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm using React.JS and when I do react-native run-android
(with my device plugged in) I see a blank page. When I shake the device and select Debug JS Remotely
from the option list I see the following screen.

FYI:
OS: Ubuntu 16.04 Node version is: v4.6.2 java version "1.8.0_111" react": "15.4.1 react-native": "0.38.0
回答1:
In my case the issue was that the emulator was making a request to:
http://10.0.2.2:8081/debugger-ui
instead of:
http://localhost:8081/debugger-ui
and the request was failing.
To solve the issue: Before enabling remote debugging on your emulator, open http://localhost:8081/debugger-ui
in chrome. Then enable remote debugging and go back to the chrome page where you should see your console logs.
回答2:
I solved it doing adb reverse tcp:8081 tcp:8081
and then reload
on my phone.
回答3:
In my case, selecting Debug JS Remotely launched Chrome, but did not connect with the android device. Normally, the new Chrome tab/window would have the debugging URL pre-populated in the address bar, but in this case the address bar was blank. After the timeout period, the "Unable to connect with remote debugger" error message was displayed. I fixed this with the following procedure:
- Run
adb reverse tcp:8081 tcp:8081
- Paste
http://localhost:8081/debugger-ui
into the address field of my Chrome browser. You should see the normal debugging screen but your app will still not be connected.
That should fix the problem. If not, you may need to take the following additional steps:
- Close and uninstall the app from your Android device
- Reinstall the app with
react-native run-android
- Enable remote debugging on your app.
- Your app should now be connected to the debugger.
回答4:
Make sure that the node server to provide the bundle is running in the background. To run start the server use npm start
or react-native start
and keep the tab open during development
回答5:
My case is that when I tap enable remote JS debugging, it will launch chrome, but can not connect to it.
I have tried to run:
adb reverse tcp:8081 tcp:8081
, did but not work.
I uninstalled my chrome totally and install a new one. And it works.