Startertutorials Blog
Tutorials and articles related to programming, computer science, technology and others.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Categories: Android. No Comments on Android Studio not able to detect emulator Ubuntu 16.04

After a long time I was trying out Android Studio on my Ubuntu 16.04 LTS desktop. The Android Studio version was 3.3. Installation went smoothly after following these installation instructions.

 

Android Studio - Android Studio not able to detect emulator

 

After the installation is completed, a new project was created with a basic activity containing a “Hello Wold” label. Now, it was time to run the project and see the output. For this step, I installed an emulator using the Android Studio’s AVD Manager.

 

Download and installation of the emulator went fine. I was able to start the emulator from AVD manager and see the emulated device on the desktop screen. Now comes the horror. 😮

 

To my surprise, when the run button was clicked and the “Select Deployment Target” dialog box displayed, there are no emulators listed in it, even though the emulated device was running.

 

Now, like everyone else, I too googled for a solution to my problem. It seems that there are lot of problems associated with emulated devices and Android Studio. I applied five to six different solutions mentioned in various forums like StackOverflow, etc. None of them worked. 🙁

 

After a few hours, I noticed a small tab in the Android Studio at the very bottom (right corner) named Event Log and it was showing a very small (very very small) red icon (generally, red means error). I opened it and it was showing error messages like “Unable to open connection to: localhost:5037 due to java.net.ConnectException: Connection refused“. I think Android Studio was trying to connect to the emulated device on the local machine (localhost or 127.0.0.1) on some random port.

 

I copied the error message from Event Log window and searched for it in Google. All the solutions were pointing to “/etc/hosts” file. Now I understood what went wrong. When I installed OpenStack few months back, I made some changes (commented a few lines) to that file.

 

The solution to this problem is, revert back any changes made to this file. This solved my problem. I restarted the emulated device from AVD Manager and this time logcat was able to detect the emulated device. I was like Oh Yeah!

 

If you don’t know exactly what to do with “/etc/hosts” file, google for the phrase “default content in /etc/hosts” file. The Google results will point you towards required solution.

 

I hope this post might help people to solve this emulated device problem in Android Studio 3.3 (might work for other versions also) and Ubuntu 16.04 desktop operating system. 🙂

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Suryateja Pericherla

Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.

He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.

He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.

Leave a Reply

Your email address will not be published. Required fields are marked *