SOLVED

How to build MAUI to apk?

%3CLINGO-SUB%20id%3D%22lingo-sub-2997645%22%20slang%3D%22zh-CN%22%3EHow%20to%20build%20MAUI%20to%20apk%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2997645%22%20slang%3D%22zh-CN%22%3E%3CP%3Ei%20try%20publish%2Cit%20can%20not%20work%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2997645%22%20slang%3D%22zh-CN%22%3E%3CLINGO-LABEL%3E.NET%20MAUI%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3001065%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20build%20MAUI%20to%20apk%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3001065%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1227530%22%20target%3D%22_blank%22%3E%40SampsonYe%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUsing%20the%20dotnet%20cli%20you%20can%20build%20an%20apk%20using%20the%20following%20command%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Edotnet%20build%20-f%20net6.0-android%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20apk%20file%20will%20be%20built%2C%20and%20you%20can%20find%20it%20at%20%3CAPP-ROOT-DIR%3E%2Fbin%2Frelease%2Fnet6.0-android%2Fcom.companyname.appname-Signed.apk%3C%2FAPP-ROOT-DIR%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

i try publish,it can not work

2 Replies
best response confirmed by SampsonYe (New Contributor)
Solution

@SampsonYe 

 

Using the dotnet cli you can build an apk using the following command:

 

dotnet build -f net6.0-android

 

The apk file will be built, and you can find it at <app-root-dir>/bin/release/net6.0-android/com.companyname.appname-Signed.apk

@StrathdeeK 

Wowo  nice, it work!!

just use dotnet cli can finish it

 

but why VS 2022 Preview Can't publish suitable apk?

SampsonYe_0-1637858578222.png