maui: Cannot generate valid Android apk
Description
I’ve tried to change the package bundle from aab to apk, for generating the apk through Archive..., but I couldn’t find the related option on the project properties, as I can on the Android project on a Xamarin Forms app (Android Options > Android Package Format). I’ve tried to force the Archive Manager to generate a apk by manually editing the .csproj file, with the following lines:
<PropertyGroup>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidPackageFormat>pkg</AndroidPackageFormat>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidCreatePackagePerAbi>false</AndroidCreatePackagePerAbi>
<AndroidLinkTool>r8</AndroidLinkTool>
<AndroidDexTool>dx</AndroidDexTool>
</PropertyGroup>
but it fails stating that Failed to create App archive 'AppName'. Invalid Android Archive (no .apk files).
Is there something I’m doing wrong here?
P.D: I don’t know if generating an apk is a expected current feature, or if it isn’t and this should be a feature request. Just tell 😄
Steps to Reproduce
- Create a blank MAUI app project.
- Manually edit the
.csprojto add the former lines. - Ensure the build is configured for
Release. - Try to archive the app.
Version with bug
Preview 12 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11
Did you find any workaround?
No.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 26 (12 by maintainers)
Ok, what is the crash?
You should check
adb logcatoutput, some instructions here:https://docs.microsoft.com/xamarin/android/deploy-test/debugging/android-debug-log#accessing-from-the-command-line