MAUI multiple errors on publishing android

Maryan 26 Reputation points
2023-07-16T19:28:27.2+00:00

While following the steps outlined in the Microsoft documentation for publishing MAUI application I encountered an issue during the publishing process. This is my first time publishing a mobile application, I'm not familiar with the process and don't have any previous experience.

Step:

dotnet publish -f net6.0-android -c Release -p:AndroidKeyStore=true -p:AndroidSigningKeyStore=myapp.keystore -p:AndroidSigningKeyAlias=myapp -p:AndroidSigningKeyPass=mypassword -p:AndroidSigningStorePass=mypassword


I got the following error:

MSBuild version 17.6.8+c70978d4d for .NET
  Determining projects to restore...
C:\Program Files\dotnet\sdk\7.0.306\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(35,5): warning NETSDK1202: The workload 'ios' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/maui-support-policy for more information about the support policy. [C:\Users\GameWa
rden\Desktop\ODWE Mob\ODWEMob\ODWEMob\ODWEMob.csproj::TargetFramework=net6.0-ios]
C:\Program Files\dotnet\sdk\7.0.306\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(35,5): warning NETSDK1202: The workload 'maccatalyst' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/maui-support-policy for more information about the support policy. [C:\User
s\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\ODWEMob.csproj::TargetFramework=net6.0-maccatalyst]
  All projects are up-to-date for restore.
  ODWEMob -> C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\bin\Release\net6.0-android\ODWEMob.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  [Microsoft.AspNetCore.Connections.Abstractions.dll] Exec (with response file contents expanded) in C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob: MONO_PATH=C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\obj\Release\net6.0-android\android-arm\linked; MONO_ENV_OPTIONS= C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runti
  me.AOT.win-x64.Cross.android-arm\6.0.20\Sdk\..\tools\mono-aot-cross.exe --debug --nollvm "--aot=asmwriter,temp-path=obj\Release\net6.0-android\android-arm\aot\armeabi-v7a\Microsoft.AspNetCore.Connections.Abstractions,profile-only,profile=C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\Resources\Splash\splash.svg,profile=C:\Program
  Files\dotnet\packs\Microsoft.Maui.Sdk\6.0.553\Sdk\maui.aotprofile,profile=C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\6.0.553\Sdk\maui-blazor.aotprofile,mtriple=armv7-linux-gnueabi,tool-prefix=C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.485\tools\binutils\arm-linux-androideabi-,outfile=obj\Release\net6.0-androi
  d\android-arm\aot\Microsoft.AspNetCore.Connections.Abstractions.dll.so,ld-name=ld,ld-flags=-s" "obj\Release\net6.0-android\android-arm\linked\Microsoft.AspNetCore.Connections.Abstractions.dll"

C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.485\targets\Microsoft.Android.Sdk.Aot.targets(91,5): error : Precompiling failed for C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\obj\Release\net6.0-android\android-arm\linked\Microsoft.AspNetCore.Connections.Abstractions.dll. [C:\Users\User\Desktop\ODWE Mob\OD
WEMob\ODWEMob\ODWEMob.csproj::TargetFramework=net6.0-android]
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.485\targets\Microsoft.Android.Sdk.Aot.targets(91,5): error : Mono Ahead of Time compiler - compiling assembly C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\obj\Release\net6.0-android\android-arm\linked\Microsoft.AspNetCore.Connections.Abstractions.dll [C:\Users\GameWa
rden\Desktop\ODWE Mob\ODWEMob\ODWEMob\ODWEMob.csproj::TargetFramework=net6.0-android]
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.485\targets\Microsoft.Android.Sdk.Aot.targets(91,5): error : AOTID 0831BB70-19B3-97F6-5B0E-7248B837B0A5 [C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\ODWEMob.csproj::TargetFramework=net6.0-android]
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.485\targets\Microsoft.Android.Sdk.Aot.targets(91,5): error : Using profile data file 'C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\Resources\Splash\splash.svg' [C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\ODWEMob.csproj::TargetFramework=net6.0-android]
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.485\targets\Microsoft.Android.Sdk.Aot.targets(91,5): error : Profile file has wrong header: '<?xml vers'. [C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\ODWEMob.csproj::TargetFramework=net6.0-android]
  [System.Runtime.CompilerServices.Unsafe.dll] Exec (with response file contents expanded) in C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob: MONO_PATH=C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\obj\Release\net6.0-android\android-arm\linked; MONO_ENV_OPTIONS= C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.
  win-x64.Cross.android-arm\6.0.20\Sdk\..\tools\mono-aot-cross.exe --debug --nollvm "--aot=asmwriter,temp-path=obj\Release\net6.0-android\android-arm\aot\armeabi-v7a\System.Runtime.CompilerServices.Unsafe,profile-only,profile=C:\Users\User\Desktop\ODWE Mob\ODWEMob\ODWEMob\Resources\Splash\splash.svg,profile=C:\Program Files\dotnet\p
  acks\Microsoft.Maui.Sdk\6.0.553\Sdk\maui.aotprofile,profile=C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\6.0.553\Sdk\maui-blazor.aotprofile,mtriple=armv7-linux-gnueabi,tool-prefix=C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.485\tools\binutils\arm-linux-androideabi-,outfile=obj\Release\net6.0-android\android-arm\
  aot\System.Runtime.CompilerServices.Unsafe.dll.so,ld-name=ld,ld-flags=-s" "obj\Release\net6.0-android\android-arm\linked\System.Runtime.CompilerServices.Unsafe.dll"

I tried multiple times to clean the code and build it again, I tried to delete manually bin and obj files and rebuild it again. In development mode, I don't see any errors. The application is running smoothly. Any help to fix the issue is much appreciated, I can't wait to try my first mobile application on my phone. Thank you!

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,231 questions
{count} votes