2

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.

Abristonks
  • 83
  • 6
  • Does this project reference a vb.net project? – tval Dec 15 '22 at 21:53
  • @tval no, the error happens when I try to build the .NET MAUI App template, there is nothing more in the code than files provided by the VS template. – Abristonks Dec 15 '22 at 22:26
  • 2
    Go to Tools->Options->Projects and Solutions->Build And Run and change the build output verbosity to Detailed. It may give you a more detailed explanation why the project fails to build. – tval Dec 15 '22 at 22:31

1 Answers1

1

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.

Guangyu Bai - MSFT
  • 2,555
  • 1
  • 2
  • 8
  • Thank you very much! This was exactly the problem, I'm surprised I didn't think of that. I update my question to show clearly what was the problem. – Abristonks Dec 19 '22 at 13:24