.NET MAUI 00F - Setting up the Android Emulators in Windows

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign emulators in Windows there's a couple things we need to do we need to make sure that we have Hardware acceleration enabled in Windows and then we need to install the Android SDK tools or update them they're not installed or current then create the Android virtual devices we'd like to use and then run those virtual devices within the visual studio to test our Maui apps there are a lot of different factors in terms of getting the Android emulators to work most importantly on the processor whether it's Intel or AMD and then also your version of Windows and the build the build of that version so what I'm going to show you is what by most modern computers are going to use in terms of enabling the acceleration and if you have problems after these instructions I would suggest coming here to the learn.microsoft.com documents for net Maui and in the get started you'll find a set up an Android device for debugging it's also under here the get started and you go to Android emulator so let's kind of walks you through those those different aspects that I just discussed we're going to use the hyper-v acceleration alternatively you can use the Android emulator hypervisor driver so to test if hyper-v will run on your computer I'm going to go to the terminal and simply type in system info and we're going to scroll down through all the info here that is provided at the very bottom we'll see hyper-v requirements there are four things here and if it says yes to all of these then your computer is ready to have hyper-v enabled you may get one saying that hyper-v is already enabled in which case you're good to go to enable hyper-v I'm going to go into the control panel and we're going to look up programs and features and click on the turn Windows features on or off and there's a couple things to check here one is hyper-v I'm going to open that up and just click on hyper-v and it'll automatically check the other items hyper-v platform is the most important it's also hyper-v management tools I'm going to scroll down and there's also the windows hypervisor platform I'm going to enable that as well simply click ok it'll apply the changes and then you'll need to reboot you'll need to restart the computer so I've rebooted let me go back to the command prompt or terminal window and I'm again going to type in system info and this time for hyper-v requirements it says a hypervisor has been detected features required for hyper-v will not be displayed so we have hyper-v now enabled it's going to close that window I'm going to go into Visual Studio 2022 to that Maui app test solution that we created when we installed Visual Studio this is basically the sample app that comes out of the box when we create a new Maui app I'm going to double click on the main page xaml that will give us our interface now up on the button bar we can choose to debug any CPU and then we see the devices we can debug on so I can divide I can debug on this Windows machine we'll come back and do that in a minute I can also debug on the Android emulators I have a whole bunch of emulators here that I've installed over the last few years doing xamarin and doing Android Studio development with kotlin you may not have anything here and so I want to show you how to set these up and think about all the different devices that are out there we've got phones we got tablets all different sizes and so you can emulate any of those and if you want to have a broad distribution you probably want to test on several different devices so we have the open Android device manager icon in the open Android SDK manager icon if for some reason you don't have those you can go to the view menu go to toolbars and make sure Android is enabled okay so I'm going to go to the Android SDK manager first on the platforms we're seeing the different Android operating systems so 12.0 11.0 10.0 9.0 these older ones I've been doing this for a long time so I've got a bunch of older operating systems installed Maui's not going to run on these older ones so we're on target are newer phones and newer tablets and there's also some SDK tools so over here you see the API the application programming interface that those different operating systems use so Android 12.0 version s uses API 31. not a bad idea to keep these updated so I might want to check the SDK platform 34 and go ahead and install some of that I'm not going to bother to do that simply because it takes a while to install these but I encourage you to keep your Android sdks up to date now as far as tools making sure that you have the SDK tools installed there's different command lines here so I have the most recent one say 7.0 you're probably good to go again you can keep those up to date so I see there's a button down here some updates available I'm going to click that so here's a bunch of updates that they're recommending I'm going to choose install updates I'm going to accept on several of these and it's going to take a while to install those so I'm going to pause the video here and come back and we'll pick up once those have been done finished updating so I'm going to close that window and I'm going to go to the open Android device manager by the way we can also go to tools Android and get to those those items there as well so let's go to the Android device manager I'm going to say yes so this is where you set up your different devices so I saw you saw earlier I had a bunch of different devices set up already let me show how you would start a new one so I'm going to click on the new and you can choose a you can type in a name I'm going to accept this pixel 5 API 33 the base device you can choose from different devices here I'll leave it at pixel 5 processor 64-bit versus 32-bit the operating system you want to Target whether you want to include a play store so you can actually load applications from the Play Store on the emulator I'm not going to do that you can also make modifications in terms of the width and height the LCD in terms of the the display I'm going to accept all this as default and I'm just going to Simply say create actually let's change the name here a little bit here let's also make this Maui so it kind of stands out that I'm going to use this for my Maui applications we'll create it's going to create that device it just take a little bit of time and a base is duplicate of one I created previously but now that device is created we can click the start button and make sure that it actually runs and there is the emulator running I'm going to leave it open I'm going to close my device manager let's go back to visual studio now in Visual Studio we can select to reload an Android device I'm going to find that pixel 5 Maui that's already open if it wasn't open it would open that emulator if I want to test this Maui sample application on the pixel 5 emulator it's building that package it's then going to install that to the emulator now I end up getting an error here that no Android SDK is matching the SDK path go to the project menu come down to Maui app test properties which won't load onto an emulator first thing I'm going to do is check to see what the target platform is something down to my Android targets and I see the target framework is empty and my minimum is way down to Android 5. so I need to change this I'm going to set this to Android 13 that's that level 33 that's my Maui emulator that could be my Target and we'll set the minimum though I'm going to set the minimum at 10 I'll go 9 level 28 pi so now I'm going to try this again go back and choose my alley emulator this is a good idea to watch the output window as this is building and installing it'll give you some Clues if something goes wrong the first time you build an app it takes a while it also takes a while first time you try to install it onto an emulator after that we make updates to it it will go pretty fast so now it's going to my emulator I'm going to pull this over just so I can see all the output here so it's deploying at the Bible says deploying to the pixel 5 Maui emulator found the device it's now installing onto the device attempting to run it and there is my project I can choose click me and it tells me how many times I clicked I'm going to leave this running here I'm going to come back over and change my label from from Hello World to hello smcc and you'll notice I didn't do anything as far as reloading it or updating the emulator this is called hot reload if you're making minor changes to your interface not adding extensive code it will do this on the Fly so for example my button I can say background color equals red and it did that also we can end the emulator and that is how we run our application on an Android emulator let me show you one other thing because I mentioned I would do this let's just go to the Windows machine and let's test it on the Windows machine so just going to install it on this Windows device and since this is not running in a virtual machine it's a little bit faster not too concerned about warnings that come up we just don't want any errors and there is our project running on the Windows device and again you can say click me until there's many times it clicked and I'll end that let's jump into this video you can see all the videos from the.net my practicum playlist by clicking on the image in the lower right if you'd like to be alerted to future videos I create you can click my picture in the top right to subscribe to the channel
Info
Channel: Stephen Hustedde
Views: 1,831
Rating: undefined out of 5
Keywords: Android, Emulator, Simulator, AVD, Android Device manager, SDK, .NET MAUI, C#, Cross-platform, iOS, Windows, CIS165DC, Hustedde, Stephen Hustedde, NET, MAUI, Xamarin
Id: oJsVwCheFLM
Channel Id: undefined
Length: 13min 32sec (812 seconds)
Published: Sat Jul 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.