I cannot attach the debugger in Android Studio while running debug on a phone.
I’m currently using a Samsung S4, running Android 4.4.4 (but have tried an S5, S6, S7, and
I am using a real device. Simply deleting the app on the device, and then running from Android Studio solved this issue.
It seems Android Studio had trouble with overwriting the file that was already on the phone.
Simply not using my google pixel 1st gen and using my new Nokia 7 plus fixed this issue :).
I have the opposite problem with Android Studio 3.3, trying to debug a wi-fi-connected phone.
After selecting the device in Android Studio, I receive the following message:
Error running 'app': Unable to open debugger port (localhost:8600): java.net.ConnectException "Connection refused: connect"
I also have IPV-6 enabled on my network.
The issue is that "localhost" resolves to ::1 on my machine by default, but ADB studiously binds explicitly to 127.0.0.1. I happen to know this because I spent the day trying to make ADB connect to emulators running on a remote machine (not since Android 4.4 unfortunately.
To solve the problem, add the following line to \windows\system32\drivers\etc\hosts:
127.0.0.1 localhost
At first i tried all the above ways, did not help. I have two computers with same settings. But at one worked at other error. It's given me an idea that it can be "hardware" problem. I switched USB to other slot with USB3.0 and used short cable and WOW it began work. I suggest there some delay in USB2.0 (polling), therefore process begin out of synch.
1.try cleaning project Build->clean project
2.do file->Invalidate/cache restart if above not helps you..
3.try to change the data cable you are using to connect your phone.
if nothing above helps, install Android wifi ADB plugin and try to do debug over wifi.
I also got same error and this thing worked for me
1. Open Android Studio -> Terminal
2. Change directory to $Android SDK Path$\platform-tools
3. Write command adb get-state and hit enter.
Then you will get this output
* daemon not running. starting it now on port 5037 *
* daemon started successfully *