When I create a new MAUI
or Xamarin.Forms
project in Visual Studio 2022
, I am seeing errors when building the project. I have tried various versions of Visual Studio, including the latest VS Preview 2. When I build the project, I get errors only in the Android project.
When targeting .Net 6.0
, no errors occur. However, when I use .Net 7.0
or .Net 8.0
, I receive the following error:
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.46\tools\Xamarin.Android.Common.targets(1987,3): error XA3006: Could not compile native assembly file: typemaps.arm64-v8a.ll
I have tried deleting obj and bin, cleaning the project, reloading and unloading, and opening VS as Admin, but I am still facing the same errors.
I have reported this issue on GitHub, on Learn, and on the Visual Studio Developer Community, but have not found a solution. How can I fix this?
It seems that you are encountering an error when building your MAUI
or Xamarin.Forms
project in Visual Studio 2022
with .Net 7.0
or .Net 8.0
targeting Android. The error you are seeing is:
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.46\tools\Xamarin.Android.Common.targets(1987,3): error XA3006: Could not compile native assembly file: typemaps.arm64-v8a.ll
This issue has been reported on several platforms, but a solution hasn’t been found yet. However, there is a workaround that you can try:
-
Right-click on your Android project in Visual Studio and select “Unload Project”.
-
Right-click on the unloaded project and select “Edit {ProjectName}.csproj”.
-
Add the following code snippet inside the <PropertyGroup>
section:
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
-
Save the changes and reload the project.
-
Build your project again and see if the error persists.
If the error still occurs, you may need to wait for a fix or try using .Net 6.0
as a temporary solution until the issue is resolved.
Note that this workaround may have some impact on the performance or behavior of your application, so be sure to test thoroughly after applying it.
Keep an eye on the GitHub issue (here) and other platforms for updates or a potential fix from the community or Microsoft.