简体   繁体   中英

React-native Could not connect to Development Server on android device

Device is connected, Package Server is running, there was issue of port 8081 ,

That's why I started this using react-native run-android and react-native start --port 8089 .

But still unable to run my first app please help, thanks in advance :) 在此输入图像描述

Have the same issue witch happens after every run-android . This line from https://facebook.github.io/react-native/docs/running-on-device-android.html helps , i press reload and it works but next time -same thing

adb reverse tcp:8081 tcp:8081

or

sudo adb reverse tcp:8081 tcp:8081

There are two ways to connect to development server.

  1. Via wifi if your mobile and pc is in same network.
  2. Via usb cable.

For num 1 go through following checklist.

  1. Check if your machine and mobile device is connected to same wifi network.

  2. Open the react native menu in mobile device by typing this command (your device must be connected to your machine via usb cable when using this command). 打开移动设备中的react本机菜单(使用此命令时,您的设备必须通过USB电缆连接到您的设备)。

  3. Click the option that stated "dev server" or something like that.

  4. Enter your machines ip address along with the port number. In my case it is 192.168.0.10:8081

  5. Reload the application and bingo.

For number 2 you can enter this command in the terminal .That will do the rest. 输入此命令。其余的将完成。

如果您在运行react-native start后有一个虚拟设备,请打开一个新终端并转到您的应用程序目录并键入adb connect 127.0.0.1:62001然后键入adb devices现在您应该看到您的设备进入您的模拟器或真实设备并摇动它(在虚拟设备中按Ctrl + 0)并进入开发设置和............

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM