While working on .NET MAUI, you may face this error.
NETSDK1147: To build this project, the following workloads must be installed: android
The error notice "NETSDK1147: To build this project, the following workloads must be installed: android" indicates that your installation of Visual Studio does not have the necessary workload installed to construct Android projects. Workloads are collections of tools, libraries, and components bundled together in Visual Studio to enable a particular development scenario. Workloads can also be used individually. In this scenario, you are attempting to construct an Android project, but Visual Studio informs you that the essential Android component is not installed on your computer.
About .NET MAUI SDK for Android
.NET MAUI (.NET Multi-platform App UI) is a framework that allows developers to construct apps for several platforms, including Android versions 5.0 and higher (API 21 and higher). When you publish a.NET MAUI app for Android, you may generate either an Android Package (APK) file or an Android App Bundle (AAB) file1. The APK and the AAB must submit your program to Google Play 1. The APK is utilized when installing your software into an Android device. An Android app can be made available to consumers in many ways, including through a marketplace such as Google Play, a website, or a file-sharing service. You can also prepare a device for development by turning on its developer mode and connecting it to your computer. This will set the device up for development.
The Solution
The default article at Microsoft Learn ( https://learn.microsoft.com/en-us/dotnet/core/tools/sdk-errors/netsdk1147) indicates to install using the dotnet command:
dotnet workload install android
This may fail and result in error 401.
Failed to update the advertising manifest microsoft.net.workload.emscripten.current: Response status code does not indicate success: 401 (Unauthorized).
So you may close your Visual Studio session and open the Visual Studio Installer, modify the installation, select .NET MAUI SDK for Android, and install it by clicking on the button Modify.
I'm happy to share this post with you, and I hope it proves helpful!