Android Studio, uiautomator and Windows failed to connect to socket 'tcp:9008':

22 Views Asked by At

I'm trying to run test with uiautomator and android studio emulator on Windows machine. It's worth to remind that I'm running the same set up and test on MacOS and everything works fine. I was debugging the peace of code for example:

from uiautomator import device as d
d.screen.off() # -> on this step program starts infinitely running

In PyCharm, no errors appeared, so I decided to use adb logcat to check what was happening. As a result:

[email protected]: Error opening kernel wakelock stats for: wakeup34: Permission denied 
ActivityManager: Failure reporting to instrumentation watcher: comp=ComponentInfo{com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner} results=Bundle[{id=ActivityManagerService, Error=Unable to find instrumentation info for: ComponentInfo{com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner}}]
382   382 E adbd    : failed to connect to socket 'tcp:9008': Connection refused

Adb server works and I was able to reboot the phone from adb commands. Adb sees that device is attached.

Set up: Phone Emulator: Pixel 3, API 30, R Env variables $ANDROID_HOME$, sdk-tools as well Installed the latest Java version uiautomator==1.0.2

I tried to restart the adb server with

adb kill-server
adb start-server

Also with

net stop winnat
net start winnat

Killed all processes with 5037

netstat -ano | findstr "5037"
taskkill /PID <PID> /F

Checked firewall settings and allowed adb to use public and private Shutted down Windows Defender

0

There are 0 best solutions below