android: Android - APT2000 build error when project path contains non-ASCII symbols

Originally opened by @janseris in https://github.com/dotnet/maui/issues/5957


Description

Putting project in a folder/directory containing some non-ASCII chars, like Czech alphabet (tested with á) breaks Android build. This does not affect any other C# projects. I have beeing using WinForms, Blazor, WPF on this path and all has been working fine for years. Even VS Solution, folder names and class and property names can contain these special symbols fine. It seems like the problem is in Android tools. I have experienced these issues with C++ compilers and other UNIX tools which live in the ASCII-only world.

Severity	Code	Description	Project	File	Line	Suppression State
Error	APT2000	System cannot find file. (2).	Tempus.Mobile.GUI	C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-preview.14.106\tools\Xamarin.Android.Aapt2.targets	217	

image

Steps to Reproduce

Put project in any path containing “á” symbol. I created a minimal repro with C:/á/ProjectFolder

Version with bug

Preview 14 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android

Did you find any workaround?

No response

Relevant log output

No response

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 2
  • Comments: 36 (23 by maintainers)

Most upvoted comments

@BernhardPollerspoeck Xamarin ships a very old version of aapt2 that appears to be before Google introduced this issue.

If you want to get the old version somehow, you can try setting $(Aapt2ToolPath) in your project:

https://github.com/xamarin/xamarin-android/blob/4125c0ce14549623df7e860bf4ad67d0d9738aad/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Aapt2.targets#L132

Ok, this problem occurs as soon as you add an AndroidAsset, on Windows only…

mkdir 'testá' ; cd 'testá'
dotnet new android
mkdir Assets ; touch Assets\foo.txt
dotnet build -bl
...
Xamarin.Android.Aapt2.targets(212,3): error APT2000: The system cannot find the file specified. (2). [C:\src\testá\testá.csproj]

The dotnet new maui template happens to use fonts as @(AndroidAsset) files.

I think it does reproduce with dotnet new maui and not dotnet new android:

dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.300-rc.2.27\tools\Xamarin.Android.Aapt2.targets(217,3): error APT2000: The system cannot find the file specified.