I can't seem to connect to a device over tcp - Original error: Could not find a connected Android device

I can’t connect to my device over tcp.
If I enter adb devices I get:
% adb devices
List of devices attached
192.168.0.14:5555 device

and I’ve used the desired_caps - desired_caps[‘remoteAdbHost’] = ‘192.168.0.14:5555’
In the logs I see:
[ADB] Killing adb server on port 5037
[ADB] Running ‘/Users/johnsayeau/Library/Android/sdk/platform-tools/adb -H 192.168.0.14 -P 5037 kill-server’
[ADB] Getting connected devices…
[ADB] Could not find devices, restarting adb server…
[ADB] Restarting adb
[ADB] Killing adb server on port 5037
[ADB] Running ‘/Users/johnsayeau/Library/Android/sdk/platform-tools/adb -H 192.168.0.14 -P 5037 kill-server’
[ADB] Getting connected devices…
[ADB] Could not find devices, restarting adb server…
[ADB] Restarting adb
[ADB] Killing adb server on port 5037
[ADB] Running ‘/Users/johnsayeau/Library/Android/sdk/platform-tools/adb -H 192.168.0.14 -P 5037 kill-server’
[ADB] Getting connected devices…
[ADB] Could not find devices, restarting adb server…
[ADB] Restarting adb
[ADB] Killing adb server on port 5037
[ADB] Running ‘/Users/johnsayeau/Library/Android/sdk/platform-tools/adb -H 192.168.0.14 -P 5037 kill-server’

not sure what I’m doing wrong

The default port over TCP is 5555. I tried changing the port to 5037- and got:
% adb devices

List of devices attached

192.168.0.14:5037 device

still no luck

I found a desired cap called adbPort and I added it. It’s not constantly killing and restarting the server now. Just haninging at “getting connected devices”

logs:
[Appium] Appium v1.15.1 creating new AndroidUiautomator2Driver (v1.37.2) session
[BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[BaseDriver] Creating session with W3C capabilities: {
[BaseDriver] “alwaysMatch”: {
[BaseDriver] “platformName”: “Android”,
[BaseDriver] “appium:platformVersion”: “6.0.1”,
[BaseDriver] “appium:deviceName”: “Nexus 7”,
[BaseDriver] “appium:noReset”: true,
[BaseDriver] “appium:fullReset”: false,
[BaseDriver] “appium:automationName”: “UIAutomator2”,
[BaseDriver] “appium:adbPort”: 5555,
[BaseDriver] “appium:remoteAdbHost”: “192.168.0.14”,
[BaseDriver] “appium:appPackage”: “com.android.calculator2”,
[BaseDriver] “appium:appActivity”: “com.android.calculator2.Calculator”,
[BaseDriver] “appium:appWaitActivity”: “com.android.calculator2.Calculator”
[BaseDriver] },
[BaseDriver] “firstMatch”: [
[BaseDriver] {}
[BaseDriver] ]
[BaseDriver] }
[BaseDriver] Session created with session id: 951aae88-f692-4d98-9e29-950e35562c0e
[UiAutomator2] Starting ‘com.android.calculator2’ directly on the device
[ADB] Using ‘adb’ from ‘/Users/johnsayeau/Library/Android/sdk/platform-tools/adb’
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices…

Hi! try to create a appium image on docker, after installing run this command “docker run -d -p 4723:4723 -e REMOTE_ADB=true -e ANDROID_DEVICES=your.ip.address:5555 appium/appium” and this should work

Try to Kill adb server and restart it once. It may helps some times. Run the following commands in CMD tool.

adb kill-server
adb start-server