A quick guide to using Emulator in Android Studio instead of your own phone
As you may or may not know, I began my journey of learning Android app development with the courses available at Udacity (you can learn more about my resources for learning here). There is a number of different Android app development courses available there (and they were all built by Google), so I am going to complete all of them.
I am now doing the first course (Android Development for Beginners which I’ve already completed in 30%) and what I love the most about it that there is as much practice in it as there is theoretical knowledge. For the last two days I have only been doing different practical exercises of the things I have learned about so far. I really feel that I am making enormous progress and I understand everything.
One of the new tools I started to use in the first practice set in the course was the Android Studio Emulator. In today’s post I will tell you a bit more about what Emulator in Android Studio is, how to set it up and use properly.
Emulator or your Android phone
Once you start using Android Studio and developing your own apps, you will have to (almost all the time) run them on real devices to make sure that what the preview shows is really true and the app is working properly.
To run the app you are creating, you need to push the green arrow on the upper part of the screen of Android Studio (or alternatively you can just click Shift + F10). Here it is:
This will open a popup which will let you choose whether you want to use your own Android phone (if it’s connected to your computer) or Emulator. Just take a look:
I have already created my own Emulator (as you can see it’s Nexus 5X), so it’s on the list. If you haven’t created one, this list will be empty and you will have to click on Create New Emulator to begin having fun.
Creating Emulator in Android Studio
Once you click on Create New Emulator, you will be able to create your own virtual (emulated) Android device. You will be able to choose from a wide variety of different devices (Phone, Tablet, Wear or TV), different resolutions, screen sizes, pixel density etc. I decided to create Nexus 6 as I really like this device (and I don’t have it “physically”).
Let’s now hit Next and see what happens. Just as I thought. We now have to choose the version of Android to be “installed” on our new device. I chose the latest version as of now, that is, Android Marshmallow. If you want to use an older version (e.g. Lollipop), you need to download it at first (just by clicking Download).
After hitting Next, you can adjust even more settings of your AVD (Android Virtual Device) like orientation or graphics. If you are only starting to play with Emulator in Android Studio, you don’t have to adjust anything here but only click Finish. Our new device will now be saved and will be available from the menu that pops up after you click to run your app (the one I showed you in the beginning of the article). As you can see my newly-created Nexus 6 is now available and I can start using it to run my app on it.
Once you click OK it will actually take a few moments before you virtual device turns on (depending on the speed of your computer). You will see the start screen as you would see in a real phone and, if everything goes OK, you will see your app (I customized my first app a little bit for the needs of this post).
Once you are done with admiring your app, you can start playing with and customizing your virtual Android device. You operate it as if you were operating a real phone, i.e. you click with your mouse on the elements as you would click with your own finger. I decided to leave my app for a moment to access the main screen of my device.
As you can see Emulator in Android Studio looks and behaves pretty much like a real Android device. Once you launch your AVD, on the right you will see a bunch of extra settings of your device, such as, Power, Volume up, Volume down, Rotate left, Rotate right, Take screenshot etc.
Once you click on the three dots on the bottom of the side menu, you will get access to even more detailed settings like Location, Cellular, Battery, Phone and so on. With these settings, you can customize almost every aspect of your device.
As you can see, using Emulator in Android Studio is a lot of fun because it lets you run your app on any type of an Android device (phones, tablet, wearables or TV). Let’s see for a test how my app looks on Nexus 9.
Share Your Thoughts
Are you an Android developer? Did you notice any errors in this post? Do you have any questions or comments?
I am only beginning my journey of becoming an Android developer and I would really like to hear from you (and learn form you). Feel free to either contact me directly or leave me your comments in the comment box below.