Forum Discussion
How to build MAUI to apk?
- Nov 24, 2021
Using the dotnet cli you can build an apk using the following command:
dotnet build -f net6.0-android
The apk file will be built, and you can find it at <app-root-dir>/bin/release/net6.0-android/com.companyname.appname-Signed.apk
To build a MAUI app to an APK, follow these steps: Open your MAUI project in Visual Studio. Switch to Android platform in the toolbar. Set the build configuration to Release (for production) or Debug (for testing). Check Android project settings: In project properties → Android Options → Packaging, you can set options like Fast Deployment. For Release builds, consider setting <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk> in the .csproj file. Build the project: Go to Build → Build Solution. Locate the APK: After build, you can find the APK in bin\Release\net7.0-android\publish\ (or corresponding path depending on your MAUI/SDK version). Deploy or test: You can install it on an Android device or run it via Xamarin.UITest.
Tip: For testing, use Debug mode; for publishing, always build Release and sign the APK.