Home > Software design >  Visual Studio fails to compile .NET MAUI project on Android
Visual Studio fails to compile .NET MAUI project on Android

Time:12-19

When I want to build my .NET MAUI Application on Android, I get this error:

1>        C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.4\tools\Xamarin.Android.Aapt2.targets(212,3): error APT2000: The specified file cannot be found. (2).
1>        Processing A:\Documents\Semestre 5 Info\Recipes-MobileApp\CookUs\CookUs\obj\Release\net7.0-android\android\bin\packaged_resources JobId: 114 Exists: True JobWorked: False
1>        Link did not succeed. Deleting A:\Documents\Semestre 5 Info\Recipes-MobileApp\CookUs\CookUs\obj\Release\net7.0-android\android\bin\packaged_resources
1>      Done executing task "Aapt2Link" -- FAILED.
1>    Done building target "_CreateBaseApkWithAapt2" in project "CookUs.csproj" -- FAILED.
1>  Done executing task "CallTarget" -- FAILED.

I tried to reinstall Visual Studio a few times, to reinstall the Android SDK Components as well, but it fails everytime.

I couldn't find any informations about this.


EDIT :

As @Guangyu Bai - MSFT pointed out, the problem is caused by the path where the project is. My path contains spaces.

CodePudding user response:

I found some information in the issue thread Android - APT2000 build error when project path contains non-ASCII symbols and Application cannot be deployed on Android.

The build error is caused by putting project in a folder/directory containing some non-ASCII chars, like Czech alphabet (tested with á) breaks Android build. However, this does not affect any other C# projects.

  • Related