Android Emulator

Devslopes by Mark Wahlbeck
A free video tutorial from Devslopes by Mark Wahlbeck
Learn programming & app development
4.4 instructor rating • 25 courses • 330,419 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. Joining me here with that slopestyle column and the last lessons we got android studio set up. And so now the next thing I want to do is set up our emulator is 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 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 avi the manager. Stands for Android virtual device. Right. Let's go to and click on this and we're going to go ahead and create some emulators. So let's go here if you had. If you don't already have any created and we can click on the plus. So create a virtual device and then here we have some categories TV where we're 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 6. And so what is an emulator Well it emulates 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 you 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 gyroscopes GPS Yes. And proximity sensors. All right. So you know pretty cool stuff. All right so let's go on sluttier Nexus 6. I'm 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 want to go ahead and download the nugget here in case so important to note that if you're using the Hexham which is the the emulator accelerator which you definitely want to then you have to install an X 86 version and then also over here if you check under the target is also very useful to install the ones that have the Google API. So if you're using anything with like maps or any of the Google services you already have that available to you. I want to hand 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 right so my system image has completed its downloads. I want to say finish and now we have an available system image to select. All right so I'm going to select it here and see 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. These are the recommended ones. And so with since we have this been downloaded now I'm going to go ahead and say it and 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 API. All right. So that's the reason these are recommended. That's when this hit next and just kind of some basic information here. The defaults are fine. You can if you want it to startup and 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 sort of the kind of looks more like a real phone. And then we can do some advanced settings so if you click on there and then some a couple of things that I want to show you is for the camera. And you can select none emulated or webcam. So if we select webcam when we launch the emulator and we go into the camera. So if you have a webcam hooked up that will actually show what the web cam is seeing. So that could be kind of useful here the network speed you're able to simulate different types of networks but you know whether the LTE all the way down to edge which is a really crappy network speeds and you can change latency and emulated performance. It says here you choose how the graphic 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 where you can pick Automattic 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 woodlice the advance 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 just a few seconds. All right so here we have an hour later 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 Hap's back home. And yes so here's our emulator and here over here we have a list of things that we can do here is our power audio. We can change the orientation. We can take screenshots. So if you click here it's just can take a screenshot of whatever you are looking at. And for Mac that is going to put it. Let's see here. Where's my desktop. Yes so on Mac is just going to save that right to your desktop. Right. There we go. Pretty. I'm going to click with that and see where you can zoom in on some stuff. You get your regular controls here. And if you click here though we get some advanced options and 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 longitude and latitude here and then click on send. And that will update your maps accordingly. I would say I just change this to 33. 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 see acceptant continue. I think that put us out in the ocean actually. So we'll see if we click on command for Mac then that gives this year gives us our pinch controls and I was going to see if I can zoom out and see see exactly where we are. But anyway so that was a bad location to put in for latitude. But anyway 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 do 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 or I'm or high speed Wi-Fi and you can change the signal strength. So yes. Very important and useful tools here. You can change the battery level. You can see here that if we change this it changes over here 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. So we can dismiss or answer that and 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 have 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 like the compass proximity pressure or 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 emulation when I click 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 DVD manager. And so this is the only one we have right now. Select it and press OK. And instant run requires that the platform corresponding to your target device is installed or it's going to go and say let's go out and install and continue because that'll be useful in the future. And so one thing with Andrii 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 it 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 I'm not a huge deal. All right so our builder has finished so says Creedle invocation finished 0 0 0 1 so that's good. Now we're going to should be able to see our app pop up here any minute. And there we go. Hello world. All righty. So there we go. And that is how you set up your Android emulators. Android studio right. So 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.