My Blog
Articles related to programming, computer science, technology and research.

30/01/2019 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 logo and icon


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 Connection refused“. I think Android Studio was trying to connect to the emulated device on the local machine (localhost or 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. 🙂

Related Links:

Leave a Reply

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

Scroll Up