.NET MAUI Android Setup

Monday, May 30, 2022

Android Setup

Okay, this took me a while and I’m not even sure what all I did to get it working. All I can say is be patient, wait for screens that require your approval, and good luck.

Before you start you should enable Hyper-V and the Windows Hypervisor Platform. To do that From the start menu search for “Turn Windows features on or off. Then select Hyper-V and Windows Hypervisor check boxes. Click OK and reboot.

Windows Features

In our app that we are writing click the little down arrow next to Windows Machine in the debug menu and select Framework next select net6.0-android.

Select the Android Framework from the dropdown listSelect the Android Framework from the dropdown list

This is where things get a bit strange. Check the Error List for a message that reads:

The Android Sdk licenses must be accepted to continue using Android. Double-click on this message to try this again.

Double click on that message to Accept the license agreements that come up. Then your debug menu should say “Android Emulator” if you’ve never setup an emulator before. Click it and the Android Device Manager should show up. Click the + New button and make sure the Base Device is Pixel 5 and the OS is set to Android 11.0 - API 30. Also make sure that Google APIs is checked. Then click the Create button.

New Device for Android EmulatorsNew Device for Android Emulators

Finally, if everything went to plan you can click on your Pixel 5 Emulator and the debugger will start up. Again, this will take some time (few minutes). Just be patient. If you get a build error just close it and try again. For some reason mine never works on the first try. It is recommended that once the emulator starts up you don’t close it until you are done with your development session. I have friends on the Android app that launch the emulator when they get to work in the morning and leave it on until they close up to go home for the evening. Anyway, if all went well you should see your app running on an Android emulator.

App running on Android Emulator

Now it wasn’t this easy for me. I couldn’t get the agreements to come up, and when I did they came one at a time in between trying to run the app. I just persevered and I finally got it working.

.NET MAUI.NETAndroid

This work is licensed under CC BY-NC-SA 4.0

.NET MAUI on Mac

.NET MAUI