DEV Community

Cover image for How to generate an APK and an AAB file on a .NET 8 MAUI app and publish on the Google Play Store
Md. Injamul Alam
Md. Injamul Alam

Posted on

How to generate an APK and an AAB file on a .NET 8 MAUI app and publish on the Google Play Store

Getting started with.NET8 MAUI was both exciting and challenging for me. This was my very first time working with the technology, and honestly, I had no prior experience with it. While trying to build and publish my first app, I encountered several unexpected issues and learning curves.

That’s why I decided to write this blog—so if you’re also starting your first .NET 8 MAUI project, you can learn from my journey and (hopefully) avoid some of the struggles I went through.
I want to express my gratitude to my teammates for their invaluable support and collaboration throughout this project.
In compliance with the client's privacy policy, I am not sharing detailed information about the app's interface, name, or description.
I will begin by explaining how to generate an APK, followed by a detailed guide on generating an AAB file.

It’s important to note that before creating an APK or AAB file, you need to generate a secret key. This key is essential for publishing your app, as any future updates must be signed with the same key. Therefore, it’s crucial to store this key securely.
Below, I’m providing the command-line instructions and a video tutorial showing exactly how to generate the key:

Command Line:

keytool -genkey -v -keystore key.keystore -alias MauiAlias -keyalg RSA -keysize 2048 -validity 10000
Enter fullscreen mode Exit fullscreen mode

Video Link:
How to generate secret key

Now, let’s generate the APK file to test the app.

Why is APK needed?

An APK (Android Package) file is what lets you install and run your app on an Android device. Creating an APK lets you test your app in the real world—check its performance, spot issues, and make sure everything works before publishing it to the Play Store. Think of it as a preview version of your app in your hands.

Generate APK File

  • Build the app

How to build the app

  • Go to the app properties

App properties

  • Select APK from the options. If APK is already selected by default, there’s no need to make any changes.

Selection apk

  • Then save your changes and build the project again. Once the build process is complete, select Release.

App released

  • Then select Publish from the project option.

Publish app

  • After completing the publish process, click the "Distribute" button.

Distribute

  • Click 'Ad Hoc' button.

Ad Hoc

  • Save ad hoc.

  • Then insert your secret key information.

Secrect Key info

  • Click Save As and enter your key store password.

keystore password

Generate AAB File

To generate an AAB file, the process is similar to generating an APK. First, you need to select the Bundle option from the Android package options.

AAB File option

  • After making the changes, set the Target .NET Runtime to net9.0. Then, choose the option that specifies the Android framework your project targets. Make sure to select Android 15.0 (API Level 35), as the Google Play Store does not allow publishing apps with API Level 34.

selecandriodverion

  • Next, build the project and select Release for publishing. After the build is complete, navigate to the bin → .NET → Android folder, where you will find the generated AAB file.

By following these steps, you can successfully generate your APK or AAB file, ready for publishing. Remember to keep your secret key safe, as it’s essential for signing future updates. With your app properly built and signed, you’re now one step closer to sharing it with users and bringing your project to life.

If you found this guide helpful, don’t forget to share it with others who might benefit from it!

Top comments (0)