Android Emulator

Devslopes by Mark Wahlbeck
A free video tutorial from Devslopes by Mark Wahlbeck
Learn programming & app development
4.3 instructor rating • 25 courses • 336,391 students

Lecture description

Learn all about the awesome Android simulator

Learn more from the full course

Kotlin for Android: Beginner to Advanced

Kotlin is an expressive, concise & powerful development language on Android. Learn everything you need to know to start

22:52:48 of on-demand video • Updated March 2018

  • Build professional, fully functional apps using Kotlin
  • Apply for Jr. Android app development jobs
  • Submit apps to the Google Play store
English [Auto] Everyone, welcome back, Johnny, be here with that Slope's stock column in the last lessons, we got Android studio set up. And so now the next thing I want to do is set up our emulators. All right. So great thing about Android studio is that you don't even need an Android device to get started. Developing the emulator works very well. There are a few things that you can do with the emulator, but for the most part, you can do most of your testing on the simulators. And when I say simulator, I mean like a simulator for your device. All right. So how do we do that? We can create some emulators and that is done here in our AVD. Manager Abeed stands for Android Virtual Device. All right. So let's go out and click on this and we're going to go ahead and create some emulators. So let's go here. If you if you don't already have any created, we can click on the plus. So create virtual device. And then here we have some categories, TV where for like watches, phones and tablets, of course. And so we're going to start with some phones and we're going to select here a Nexus six. And so what is an emulator? Well, it emulates all of pretty much everything in the Android stack, you know, all of your including software and hardware. So if we click on this here new hardware profile, we can actually see kind of what is being simulated. So device type here, we can set the portrait or landscape that includes things like the back in front facing camera, even accelerator, gyroscope or accelerometers, gyroscopes, GPS and proximities sensors. All right. So, you know, pretty cool stuff. All right. So let's go and select our Nexus six and we're going to say next and then we need to select a system image here. We have some some options and it looks like we don't have any of these system image download system images downloaded. So I'm going to go ahead and download the nugget one here. OK, so important to note that if you're using the maximum, which is the the emulator accelerator, which you definitely want to, then you have to install an 86 version. And then also over here, if you check under the target, it's also very useful to install the ones that have the Google APIs. So if you're using anything with, like maps or any of the Google services, you already have that available to you when we go in and click download here. And then we are going to accept the terms and conditions and say next, and this is going to download and hopefully not take too long already. So my system image has completed its downloads. So I'm going to say finish. And now we have an available system in which to select. All right. So I'm going to select it here. And so what this is doing, this is just telling the emulator what version of Android to run off of. So we could do, oh, nugget, marshmallow, lollipop, some other ones. These are the recommended ones. And so with since we have this one downloaded now, I'm going to go ahead and say next. And just real quick, when I go back to this, it says, We recommend these images because they run on, they run the fastest and support Google Apps. All right. So that's the reason these are recommended as when I hit next. And just kind of some basic information here. The defaults are are are fine. You can if you want it to start up in landscape for whatever reason or portrait, you can select the specific one device frame this will it'll show kind of an Android phone frame around the simulated image just so it kind of looks more like a real phone. And then we can do some advanced settings. So if we click on there, then some a couple of the things that I want to show you is for the camera, you can select none emulated or webcam. So if we select webcam, when we launch the emulator and we go into the camera, you know, if if you have a webcam hooked up, will actually show with the webcam seeing. So that can be kind of useful here. The network speed, you're able to simulate different types of networks be, you know, whether it be LTE all the way down to EDG, which is really crappy network speeds, and you can change the latency and emulated performance. It says here you choose how the graphics should be rendered an emulator. If you choose hardware right here, then it'll use your computer's graphics card for faster rendering. If you use software, then it's going to emulate the graphics and software. All right. And so if you want to do specific things, then you could choose either of those. I usually pick the hardware or you can pick automatic and it'll pick the fastest one for you. All right. And then down here, make sure that this is checked and able keyboard input so that you can use your keyboard to type instead of having to click on the little tiny keyboard that pops up. All right. And then we're done. Let's go ahead. And Wollersheim the advanced settings and finish. All right, so now we have ourselves an Android virtual device, so let's go ahead and run it. You click right here to launch it. If you want to go back and change anything, you can edit it. And if you want to duplicate wipe the data or any of these things, then you can do that right there. So let's go ahead and run it. And this will take a just a few seconds. All right. So here we have our emulator and you can do pretty much all the stuff that you can do in your regular device. We can pull up here and we can take a look at our different apps back back home. And yeah, so here's our emulator. And here over here, we have a list of things that we can do. Here's our power audio. We can change the orientation. We can take screenshots. So if you click here, it's just going to take a screenshot of whatever you're looking at and for Mac, that is going to put it. Let's see here. Where's my desktop? Yeah, so on. Mac, it's going to save that right to your desktop. All right. There we go. Very pretty. I'm going to click with that. Let's see here. You can zoom in on some stuff and you get your regular controls here. And if you click here, though, we get some advanced options, some extended controls. So let's take a look at these. We got some useful stuff here. So if you're working with location services and you need to simulate a specific location, you can go ahead and enter the latitude or the longitude and latitude in here and then click on send and that will update your maps accordingly. Let's say I just changed this to 33. I'm not sure exactly where that's going to put us. The default is at the Googleplex. So if we click on maps here. And we'll say accept and continue. I think, oh, that put us in the ocean, actually. So we'll see if we if you click on command for if you're on Mac, then that gives you this year gives us our pinche controls. And I was going to see if I could zoom out and see see exactly where we are. But anyway, so that was a bad location to put in for our latitude. But anyways, let's go ahead and go back to the home screen. So but yes, that's how you can change the latitude and longitude. You can check out your cellular. So when we set up the emulator, we set a network type. But if you want to change how things look on the fly, then you can actually change that right in here. So right now, we're on full. If you need to test on a very slow network, then you want to go to EDG or something. And so that's very important for testing. You want to make sure that your app performs well under a variety of network speeds. You can't just assume that everyone is on blazing fast LTE all the time. All right. Or high speed Wi-Fi and you can change the signal strength. So, yes, some very important and useful tools here. You can change the battery level. You can. See here that as we change this, it changes over here in the in the status bar, if you need to check how your app reacts to receiving notifications like phone calls or messages, so we could call the device and that will actually mock up a call here. All right. And so we can dismiss or answer that. I'm going to dismiss it. And we can also simulate a tweet, so that's pretty cool. All right, so what else do we got here? We have a fingerprint. We got virtual sensors. This is pretty cool. So say you're building some sort of game or something that relies on the gyroscopes and accelerometers. You can simulate those changes right here as well. And then we have some additional sensors, you can change things like the ambient temperature, magnetic field, if you're working with something that uses uses like the compass, proximity, pressure, a whole bunch of cool settings that you can change. All right. And that's pretty much the most useful ones that I want to go over and share with you. And yeah, that's the emulator. So just to wrap this up, we're going to go ahead and run our test app here in the simulator. So when I click right here on the play button and it's going to run it and it's going to show us our emulators that we have created in our video manager. And so this is the only one we have right now. I'm going to select it and press, OK? And instant run requires that the platform corresponding to your target device is installed. Right. I'm going to go ahead and say let's go ahead and install and continue, because that'll be useful in the future. And so one thing with Andrew's studio is sometimes you'll find that there's a whole bunch of things that it needs as you're going along, but it's pretty good at telling you when you need it and just giving you a very direct download link. And so you'll run into it. You'll say, OK, I need this thing, go ahead and download it, and then you just continue on your merry way. All right. So not a huge deal. All right, so our build has finished, so says Gradle and vacation finish zero zero zero. So that's good. Now we're going to should be able to see our app pop up here any minute. And hey, there we go. Hello, world. All righty. So there we go. That is how you set up your Android emulators in Android studio. All right. So I hope that's pretty fun for you. And in the next lessons, we're going to be using these heavily. So I will see you then.