Skill Level Intermediate
- [Instructor] If you're working on an application that depends in some way on Google Play, whether it's the Google Play Store or the Map interface or any other aspect of the Google Play echo system, in the past you would have had to test that application on a physical device. But that's not the case anymore. You can now create a virtual device that runs on the Android Emulator and has Google Play Store and everything else you need already installed. First check your SDK manager and make sure that you have the appropriate system image installed.
So for example, I'm working with Android 8.1. I'll go to the SDK platforms tab and show my package details. And I'll show that I have the Google Play Intel Atom System image installed. If you don't have it installed, add it now before you go on to the next step. Now I'll open a project, and really this could be any project at all. And I'll open up the AVD manager. In Android Studio 3.01, this is under the Android sub-menu but on Android Studio 3.1 and later, it appears up here at the top.
Now I'll create a new virtual device. You have to choose a specific device definition for this to work. Notice this new column labeled Play Store. Scroll down and look for the Play Store icon. As of the time of this recording, you had to choose either Nexus 5X or Nexus 5. There aren't any available definitions for this under tablets at this point. So I'll go back to phone. I'll scroll down. I'll choose the most recent phone, the Nexus 5X, and then I'm presented with my options.
There are system images available starting in Android 7.0 and going through the most recent Android 8.1. I'll select the most recent version. That's the one that I already have installed and I'll click through to create my new virtual device. That's the Nexus 5X and here it shows Google Play. Don't worry about the null value. I'll click the start button and that will fire up my new virtual device. This message indicating that some kind of snapshot doesn't exist is a part of the new version of the emulator.
As you'll see in a moment, when you close down a virtual device, a snapshot is taken and the next time you open the virtual device it's incredibly fast. So now my Android virtual device is open and notice that there's now an icon for the Google Play Store. I'll click it to open the store and now this process should look very familiar to anyone who's used an Android device that uses the Play Store. You're being asked to sign in with your Google account. So you'll need to provide your email, your password, and everything else that you would use, and I encourage you to use a separate developer account if you can rather than your daily email for this sort of operation.
But after that you'll be able to go to the Google Play store and download whatever apps you want. This is a fully featured Android device, but because it's a virtual device, you have the benefit that if you mess it up in some way during your development process, you can wipe it clean and start over with a minimum of pain. Now in addition to the Google Play store functionality, we have the snapshot functionality which is a part of the emulator itself. When I close the device, I'll see this message indicating that the state of the device is being saved.
Once it's closed, I'll go back to my virtual device manager, and I'll start up the device again. And this time because I'm working from an existing state, the device starts up almost instantly and I'm right back to where I started. So those are some of the advantages of the latest version of the emulator. And of the system images that include Google Play.
Q: Why can't I earn a Certificate of Completion for this course?
A: We publish a new tutorial or tutorials for this course on a regular basis. We are unable to offer a Certificate of Completion because it is an ever-evolving course that is not designed to be completed. Check back often for new movies.