Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adb -s 192.168.1.6:5555 ..... error: more than one device/emulator

I am working with react native, and would like to switch adb to wifi for easier debugging.

I connect my device using usb, then type these commands.

adb tcpip 5555

Then I disconnect my usb cable and enter this command

adb connect 192.168.1.6
connected to 192.168.1.6:5555

adb devices result in the following

adb devices
List of devices attached
192.168.1.6:5555        device

So it only shows one device connected. However trying this command

adb reverse tcp:8081 tcp:8081

gives me the following error even though only one device is shown with adb devices command as shown above

error: more than one device/emulator

So I tried this command but I also get the same error

adb -s 192.168.1.6:5555 reverse tcp:8081 tcp:8081
error: more than one device/emulator

Trying the following gives me the same error

adb -s "192.168.1.6:5555" reverse tcp:8081 tcp:8081
adb -s "192.168.1.6" reverse tcp:8081 tcp:8081
adb -s 192.168.1.6 reverse tcp:8081 tcp:8081

even trying to use the device id which I copied when it was connected to usb resulted in the same error

adb -s deviceid reverse tcp:8081 tcp:8081

Is there a way to make adb reverse work when adb is connected wireless?

Thanks for advance.

like image 964
Abdalla Avatar asked Jul 30 '18 10:07

Abdalla


3 Answers

I made two changes to the steps to get this working.

1) BEFORE disconnecting the wire from my phone, I ran adb reverse tcp:8081 tcp:5555 (note the 5555 port number for the phone) and adb connectMY.PHONE.IP.ADDRESS:5555` (with port number).

Only now did I disconnect the wire.

Then I installed the app, although it probably would work if the app was already installed.

2) After the app was installed and I was getting errors "Unable to load Script” and “Could not connect to development server”,

  • opened the developer menu (shake the phone with the React Native app open) and selected “Dev Settings”. Selected “Debug server host & port for device” from the menu.
  • In the window on my phone I entered MY.COMPUTER.IP.ADDRESS:8081

Now I could open/close the app for a reload, and shake -> debug JS remotely.

like image 186
Lazer Porter Avatar answered Nov 20 '22 15:11

Lazer Porter


When I am facing the same issues than doing like below:

1) kill your process of 8081 port for using this command : kill -9 $(lsof -t -i:8081)

2) Reset your adb connection with : adb usb if you want to run via wifi then connect your device again : adb tcpip 5555

3) Start your npm : npm start

4) Then after you can run your react native app : react-native run-android

and it's works fine for me.

like image 1
Brijesh Goswami Avatar answered Nov 20 '22 15:11

Brijesh Goswami


Simple, Start task manager and kill adb.exe process and run adb devices command

like image 1
MiKhatri Avatar answered Nov 20 '22 17:11

MiKhatri