How do I build an apk for an Avalonia android app?

563 Views Asked by At

I'm trying to build an Android app with Avalonia (using Visual Studio 2022 Community on Windows). How do I make a .apk file? Building the solution results in the following files created in the bin\Release\net7.0-android\:

MyApp.Android.dll
MyApp.Android.pdb
MyApp.Android.runtimeconfig.json
MyApp.Android.xml
MyApp.dll
MyApp.pdb

... and no APK anywhere. I have tried reading the manual but it appears to only explain debugging on an USB-attached and doesn't mention building an installable package.

1

There are 1 best solutions below

2
On BEST ANSWER

In Visual Studio, right click on the Android project in the Solution Explorer and go to Properties, then to Android -> Options and ensure the Android package format is set to "apk".

Next, build the Android-project with the Release configuration.

Then right click on the Android-Project and click Archive... - this will create an APK. Click View Archives... to see previously created apk bundles.

Similar to how it's done in MAUI