1

In Android Studio, I can successfully do a clean build, but every time I try Run, I see the "Select Deployment Target" window say Initializing ADB, but then in Connected Devices I see .

I can create a Virtual Device, but after creating it I can't see it in the Connected Devices window. If I go to Android Virtual Device Manager I can see the new device and several others I have created.

I can open terminal and run adb connect 192.168.1.229 (my device's wifi IP) and get a connection. Then I can run adb devices and see it listed. But still the Connected Devices does not show it.

The idea.log repeats the following:

2018-10-29 18:36:00,808 [st Monitor]   WARN -            #com.android.ddmlib - Unable to open connection to: localhost/192.168.1.43:5037, due to: java.net.ConnectException: Operation timed out 
2018-10-29 18:36:00,808 [st Monitor]   WARN -            #com.android.ddmlib - Connection attempts: 12 
2018-10-29 18:36:00,825 [st Monitor]   INFO -            #com.android.ddmlib - adb restarted 
2018-10-29 18:37:17,045 [st Monitor]   WARN -            #com.android.ddmlib - Unable to open connection to: localhost/192.168.1.43:5037, due to: java.net.ConnectException: Operation timed out 

I have no idea why it is trying 192.168.1.43 and there does not seem to be a server running there. Is this a setting I have to change?

Attempted fixes:

  • kill the adb server
  • restart Android studio
  • restart laptop
  • upgrade Android Studio and reinstall with default settings rather than keeping my old ones

System Details:

  • OSX 10.13.6
  • Android Studio 3.2.1
  • Android Debug Bridge version 1.0.40 Version 4986621
2

For posterity the answer was that localhost had been reassigned. I discovered this by typing "ping localhost" at the terminal. The solution was to add a line in etc/hosts, as Chappie said. I have still not been able to figure out what caused it to be reassigned, nor how. Warning that reassigning your localhost could cause some programs to cease working correctly.

1

I think I have the same problem,I found the key is my localhost's IP has changed,so android studio can't connect to the right IP. Just edit /etc/hosts input this: 127.0.0.1 localhost and restart Android studio,the problem resoved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.