.NET MAUI Android target publishing/archiving
Publish a .NET MAUI app for Android
https://github.com/dotnet/maui/issues/4377
Publish a .NET MAUI app for Android step by step
vs 2022
step 1:change project to Release
step 2: Build your .NET MAUI Android app - clean and rebuild project
step 3:Right click on Maui project - publish(部署)
step 4:Archive(打包)
Manually Signing the APK
Description
Publish a .NET MAUI app for Android
Steps to Reproduce
1- Create a new -> Maui Blazor App.
2- Change development mode to -> Release.
3- Choose Framework -> net6.0-Android.
4- Choose your android emulator.
5- Run the App (with or without debugging).
6- The app will run then crush.
Detail step by step
Right click on Maui project - publish
publishing builds the app, and then copies the aab and apk files to the bin\Release\net6.0-android\publish folder. There are two aab files, one unsigned and another signed. The signed variant has -signed in the file name.
output
正在将文件从“D:\tmp\MauiApp4\MauiApp4\obj\Release
et6.0-android\android\bin\com.companyname.mauiapp4.apk”复制到“D:\tmp\MauiApp4\MauiApp4\bin\Release
et6.0-android\com.companyname.mauiapp4.apk”
Enable your device for development
请确保目标设备已启用了开发人员模式。由于错误 00000490,无法检查本地计算机上是否已启用开发人员模式。
详细了解开发人员模式,请访问 https://go.microsoft.com/fwlink/?linkid=2128411
如何让MAUI项目打包成apk而不是abb
Archiving and publishing a .NET MAUI Android app (both .NET MAUI and .NET MAUI Blazor) to an aab works.
Step 1: Update your csproj file
edit and add code in MauiApp4.csproj
D:\tmp\MauiApp4\MauiApp4\MauiApp4.csproj
<AndroidPackageFormat>apk</AndroidPackageFormat>
The information will look like this, and needs to be contained within the
<PropertyGroup>
</PropertyGroup>
node.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<AndroidPackageFormat>apk</AndroidPackageFormat> <!-- add here -->
<RootNamespace>MauiApp4</RootNamespace>