Udemy

Android Emulator

A free video tutorial from Devslopes by Nathan Sevedge
Learn programming & app development
Rating: 4.2 out of 5Instructor rating
26 courses
358,467 students
Android Emulator

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]
Hey, everyone. Welcome back. Johnny B here with snopes.com 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't do with the emulator, but for the most part you can do most of your testing on the emulators. And when I say emulator, 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. Avd stands for Android Virtual Device. All right. So let's go ahead 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 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 the device type here, we can set the portrait or landscape that includes things like the back and front facing camera, even accelerator gyroscope or accelerometer gyroscope and proximity sensors. All right. So, you know, some pretty cool stuff. All right. So let's go ahead 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. Okay. So important to note that if you're using the Hacsin, which is the the emulator accelerator, which you definitely want to, then you have to install an x86 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. So I'm going to go ahead 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. All righty. So my system image has completed its download, so I'm going to say finish and now we have an available system image 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. All right. So we could do, oh, nugget, marshmallow, lollipop, some other ones. And 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, we want to go back to this. It says, we recommend these images because they run on they run the fastest and support Google APIs. All right. So that's the reason these are recommended. So I'm going to hit next and just kind of some basic information here. The defaults are fine. You can if you want it to start up in landscape for whatever reason or portrait, you can select a 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, if you have a webcam hooked up, it'll actually show what the webcam is seeing. So that could be kind of useful here. The network speed, you're able to simulate different types of network speed, you know, whether it be LTE all the way down to edge, which is a really crappy network speeds and you can change the latency and emulated performance. It says here you choose how the graphics should be rendered in 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, enable 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 well, let's hide the advanced settings and finish. All righty. So now we have ourselves an Android virtual device. So let's go ahead and run it. You can 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 just a few seconds. All right. So here we have our emulator and you can do pretty much all the stuff that you could do in your regular device. We can pull up here and we can take a look at our different apps, go back, go 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? Um, yeah. So on Mac, it's just going to save that right to your desktop. All right. There we go. Very pretty. I'm going to quit that. Um, let's see here. You can zoom in on some stuff and you got 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've 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 out in the ocean, actually. So whoopsie. If we if you click on command for if you're on Mac then that gives us your gives us our pinch 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. Um, so, but yeah, so 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'd want to go to Edge 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 yeah, some very important and useful tools here. You can change the battery level. You can see here that if as we change this, it changes over here in the in the status bar. Um, 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 or a whole bunch of cool settings that you can change. All right. And that's pretty much the 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 emulator. So I'm going to 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 manager. And so this is the only one we have right now. So I'm going to select it and press, Okay. And instant run requires that the platform corresponding to your target device is installed. All right. So 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 Android 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, okay, 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 it says Gradle invocation finished 000 warning. 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. And that is how you set up your Android emulators in Android studio. All right. So 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.