maui
maui copied to clipboard
Allow Android archiving for both Apk and Aab formats
Description
I would love to archive my MAUI project for Android platform and get, at the end of the package generation, both apk and aab files. Currently, MAUI allow making archive for only one format as such APK or AAB.
Example of archiving process via Visual Studio try with "apk;aab" value for AndroidPackageFormat property in my main MAUI project :

Public API Changes
Allow to choose both Apk and Aab for AndroidPackageFormat property in the csproj of my main MAUI, as follows :
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- My project declarations -->
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-android|AnyCPU'">
<RunAOTCompilation>True</RunAOTCompilation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-android|AnyCPU'">
<!-- Indicate I want both apk and aab at the end of archiving process -->
<AndroidPackageFormat>apk;aab</AndroidPackageFormat>
</PropertyGroup>
</Project>
Intended Use-Case
As recommended by Google Play Store policies, I will still use Aab format in order to publish my application. But in my company, we have a validation process which implied a security audit of my MAUI/Android application. In order to make that check, we have to provide the application with an Apk format.
I'm able to achieve my deliveries with two steps : one to generate Aab format and another to generate Apk and this could be a quite annoying. With this feature, I will feel more comfortable if I can generate both Apk and Aab formats with only one archiving process.
Hello there! Thanks for the report! I don't think the archiving UI is already completely done for .NET MAUI. I'm asking around about that so I will get back to that.
When I looked into this a while back (#4377) I remember that when you do not change anything about the csproj and you run the publish command, you would get both the aab and the apk already, also signed if you have that configured. Also see: https://github.com/dotnet/maui/issues/4377#issuecomment-1073902319
Does that help you at all? Is that different from what you see?
cc: @jonathanpeppers @maddymontaquila
Hi @JasLieb. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Your settings don't seem quite right:
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-android|AnyCPU'">
<RunAOTCompilation>True</RunAOTCompilation>
</PropertyGroup>
You don't want AOT in Debug builds, in fact, you should be getting a build warning that says so? I would remove this section ^^
This one should also be the default, so just remove it?
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-android|AnyCPU'">
<!-- Indicate I want both apk and aab at the end of archiving process -->
<AndroidPackageFormat>apk;aab</AndroidPackageFormat>
</PropertyGroup>
Release builds have AndroidPackageFormats (with an s) set to apk;aab by default.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.