简体   繁体   中英

Why are Android Asset files in Visual Studio (Xamarin) not allowed to have accents?

I have a Visual Studio (Xamarin, Android) project with a file which has an accent character in the name:

 diário.png

This file is in the Assets folder, and marked as an Android Asset.

在此输入图像描述

Unfortunately when I build the project, I get a compile error:

C:\\Users\\vchel\\Documents\\FlatRedBallProjects\\AndroidSpecialCharacter\\AndroidSpecialCharacter\\obj\\Debug\\assets\\content\\gumproject\\dißrio.png : error : Invalid filename. Unable to add.

Notice that the file is diário.png in my project, but the error references it as dißrio.png.

If I rename the file to diario.png (no accent above the letter a) the project builds fine.

I know I could work around this by not using accent characters in my file but this seems like a strange restriction. Is this a known issue? Is there another way to solve this other than avoiding using accents in file names?

Asset naming restrictions are bound all the way back to Android API 1 , the related build tools and .apk packaging (and has nothing to due with the Xamarin framework).

  • Valid characters for naming resources are [az, _, 0–9]

    • Lowercase characters, numbers, and underscore
  • Use an underscore ( _ ) as a multi-name separator between "words" in your assets

    • Spaces hyphens, and periods are not allowed
  • The first letter can be either _ or a small case character

    • Numbers are not allowed as the first character

Note: There used to be notes on these restrictions on the Android Developer site, but I can no longer find them as they stripped out most docs for the build tools

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM