I'm trying to debug my React native application on WSA but it doesn't work saying that the port is already in use and the metro bundler doesn't connect, when trying to reverse the port (on actual device, it works without issues).
The warning which I get when running yarn react-native run-android is:
warn Failed to connect to development server using "adb reverse": Command failed: C:\Users\hp\AppData\Local\Android\Sdk\platform-tools\adb -s 127.0.0.1:58526 reverse tcp:8081 tcp:8081
It installs the app but doesn't proceed:
Error shown by app
And when I try to execute adb reverse tcp:8081 tcp:8081, it ends up with this:
adb.exe: error: cannot bind listener: Address already in use
As a result, the metro bundler doesn't work.
Related
The following scenario:
Windows 10 machine with adb version 1.0.40
rooted Android phones, anything from android 5 to 8
An application does the following on each found adb device:
a reverse connection is set up on each phone using adb -s xxx reverse tcp:8080 tcp:8080
using adb -s xxx reverse --list is checked if the reverse is set up correctly
The android application opens a WebSocket connection to a running WS server on the PC
On Android 6 and higher, the --list command returns (reverse) tcp:8080 tcp:8080, which is correct. The android application opens the WebSocket connection properly.
Problem:
On any Android 5 phone, the following happens:
opening the reverse works properly.
Android is opening the WS connection to the PC
The command adb -s xxx reverse --list is returning the error error: protocol fault (couldn't read status length): No error
This causes the phone to be disconnected and reconnected again (seeing the windows popup of the connected device)
This, of course, also kills the WebSocket connection
Now my questions:
I couldn't find the above error message, even with googling.
Shouldn't it at least appear somewhere in some Adb source code?
Is there any component which does the Adb stuff on Android, that
could be updated somehow, or is it tied to the android version?
Could this check (adb reverse --list) also done on the adb shell?
Any other ideas how to do the check without that command or make the
command work on Android 5?
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.
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.
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.
Simple,
Start task manager
and kill adb.exe process
and run
adb devices
command
Hi, I'm a beginner with React Native, while running react-native run-android, this error was returned.
BUILD SUCCESSFUL
Total time: 15.473 secs
This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Running /home/gustavo/Android/Sdk/platform-tools/adb -s XXXXXX reverse tcp:8081 tcp:8081
Starting the app on XXXXXXX (/home/gustavo/Android/Sdk/platform-tools/adb -s XXXXXXX shell am start -n com.aa/com.aa.MainActivity)...
Starting: Intent { cmp=com.aa/.MainActivity }
**but nothing works**
before it worked.
I already uninstalled the app from my phone.
I've run the command "adb -s XXXXX reverse tcp: 8081 tcp: 8081"
I already deleted the folder node_modules and executed the command "sudo npm install"
I believe it is on the cell phone as it started to happen this after having done some biuld over wifi.
Does anyone know what can it be?
enter image description here
enter image description here
You need to start the development server with npm start in your project.
Make sure that the app is already installed on your phone, so it can communicate with the dev server.
Check the output of the terminal window running the development bundler. It’s likely you just have a syntax error in your code.
BUILD SUCCESSFUL
Total time: 2 mins 6.65 secs
Running C:\Users\arnold\AppData\Local\Android\sdk;/platform-tools/adb -s 192.168.95.101:5555 reverse tcp:8081 tcp:8081
Could not run adb reverse: spawnSync C:\Users\arnold\AppData\Local\Android\sdk;/platform-tools/adb ENOENT
Starting the app on 192.168.95.101:5555 (C:\Users\arnold\AppData\Local\Android\sdk;/platform-tools/adb -s 192.168.95.101:5555 shell am start -n com.testproject/com.testproject.MainActivity)...
The build successful but it's not shown in GenyMotion emulator.
i running on Android 5.0.0 (API 21)
You can click the device option button, or if it doesn't exist for your device use adb shell input keyevent 82 command and select Dev Settings from menu, and then from the section DEBUGGING choose Debug server host & port for device and enter your PC's IP (you can find your IP from ipconfig command for Windows) for example 192.168.1.12:8081.
after that, you can reload your application from options menu or restart your application.
Please pay attention:
Your device and pc must be on the same network
Host port can be found from node window, for example: Running Metro Bundler on port 8081.
React-native option menu:
Node window and successful Bundle loading
I am running my android appium execution on MAC machine.
I have installed android studio and have set the path variable.
While executing adb start-server I got below error:
adb server version (32) doesn't match this client (36); killing...
error: could not install smartsocket listener: Address already in use
ADB server didn't ACK
failed to start daemon
error: cannot connect to daemon
Firewall setting is turned OFF and no other ADB present like GenyMotion.
Did you set android sdks, platform-tools and tools path in your bash_profiles? Or Could you navigate to android sdks path and try to execute adb start-server command? If you are running appium from appium app then I would recommend to set android sdks path in settings.