Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native adb reverse error: more than one device

I am learning react native. I can successfully connect my android device using USB. But when I try to connect it using wifi, it gives me an error.

$ adb kill-server      
$ adb version
Android Debug Bridge version 1.0.40
Version 4986621
Installed as /home/subtleseeker/Android/Sdk/platform-tools/adb          
$ adb connect 172.26.40.211:8081

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
connected to 172.26.40.211:8081
$ adb devices                   
List of devices attached
172.26.40.211:8081      device

$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
cache results.bin (/home/subtleseeker/.gradle/caches/transforms-1/metadata-1.1/results.bin) is corrupt. Discarding.

> Task :app:installDebug 
Installing APK 'app-debug.apk' on 'POCO F1 - 8.1.0' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL in 31s
27 actionable tasks: 1 executed, 26 up-to-date
Running /home/subtleseeker/Android/Sdk/platform-tools/adb -s 172.26.40.211:8081 reverse tcp:8081 tcp:8081
error: more than one device/emulator
Could not run adb reverse: Command failed: /home/subtleseeker/Android/Sdk/platform-tools/adb -s 172.26.40.211:8081 reverse tcp:8081 tcp:8081
Starting the app on 172.26.40.211:8081 (/home/subtleseeker/Android/Sdk/platform-tools/adb -s 172.26.40.211:8081 shell am start -n com.awe4/com.awe4.MainActivity)...
Starting: Intent { cmp=com.awe4/.MainActivity }

In the Dev settings of the app, I have configured Debug server host & port for device to the ip address of my computer as 172.26.43.71:8081. Also it is clear from the output, that the connection was successful and the apk is installed.

I can't see how to resolve this error: error: more than one device/emulator. Any help is appreciated.
NOTE: This question may be a duplicate of this, but it doesn't have any answers.

like image 714
subtleseeker Avatar asked Aug 24 '26 13:08

subtleseeker


2 Answers

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

  • Restart adb by issuing adb kill-server followed by adb start-server in a command prompt.
  • Disable and re-enable USB debugging on the phone Rebooting the phone if it still doesn't work.

my issues have been resolved with these steps.

like image 160
Saurabh Avatar answered Aug 27 '26 05:08

Saurabh


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 24
Brijesh Goswami Avatar answered Aug 27 '26 05:08

Brijesh Goswami



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!