Invalid Resource Directory Name: obj/Debug/res/ fonts RRS feed

  • Question

  • User150101 posted

    I'm currently trying in change our fonts to be referenced as resources following the Xamarin Fonts Guide, but I'm seeing a weird issue where if i add my font and set the build action to 'AndroidResource', the build fails with the following error: invalid resource directory name : error APT0000: obj/Debug/res/ fonts

    The strange part is that the invalid file path has an extra space, but I don't know where its coming from. I've tried and recreated this with different directory names. I've also checked my csproj file in case the space was added there with no luck.

    Has anyone else seen this issue or know a fix?

    Wednesday, November 15, 2017 5:21 PM

All replies

  • User155041 posted

    Hi @slajalin

    delete font folder and create folder in assets/fonts and clean Rebuild

    Thursday, November 16, 2017 5:31 AM
  • User150101 posted

    Hi @Charwaka , thanks for the suggestion. However, I want to build the font as an AndroidResource, not as an asset. I did try to add the font to assets/fonts folder but once I set the build action to AndroidResource, I get a invalid resource directory name : error APT0000: obj/Debug/res/ assets

    I believe this is something strange with setting a build action to be AndroidResource for a font.

    Thursday, November 16, 2017 6:25 AM
  • User180862 posted

    Hey @slajalin! Did you manage to solve this? I'm getting the same, but a coworker is working with the exact same project in Windows and it compiles just fine. Are you by any chance working on VS for Mac?

    Thursday, November 30, 2017 11:21 PM
  • User12817 posted

    We have a sample demonstrating a font as an AndroidResource:


    This is a fairly new feature as of Android 8.0(API 26) and Support Library v26 to include fonts as XML. Documentation available here:


    Do you perhaps have a project that you can upload to this post that is failing on your end?

    Saturday, December 2, 2017 8:01 PM
  • User150101 posted

    @LesterBotello Thanks for the headsup! Yes, my entire team is developing through VS for Mac which might be why we couldn't get ours to compile at all. We've pulled out our task to our backlog for now for us to revisit, but that's hardly a solution.

    @JohnDouglas Thanks for your reply. Yes, that's the tutorial i've been following, but could not get past pulling in the font. I cannot upload our actual project, but I've created a small sample app where I get the same error when trying to build the android app. I unfortunately can't post links yet with this account, but it's the only project i have on github on an account with the same name.

    It's interesting to see that this may be only a VS for Mac issue. Hope this helps and thank for your help!

    Monday, December 4, 2017 10:32 PM
  • User12817 posted


    Can you double check that your Build Tools version inside your Android SDK is >= 26.0.0? Can you also get me a Diagnostic Build Output?

    Monday, December 4, 2017 10:51 PM
  • User150101 posted

    @JohnDouglas Unless there is a different Build Tools I need to look at, I checked and do have 26 installed in my instance of Visual Studio. Unfortunately, I can't show a screenshot, but It's in my Preferences -> Projects -> SDK Locations -> Android and there's a tab named 'Tools' where it lists all available versions of 'Android SDK Build Tools'.

    I've also attached my diagnostic logs.

    Tuesday, December 5, 2017 3:52 PM
  • User365887 posted

    Experiencing the same problem, any ideas? I double checked my VS for mac and Android SDK and everything is updated to the latest version.

    Wednesday, February 28, 2018 12:46 PM
  • User365887 posted

    In my case the error was caused by incorrect folder name - I had Resources/fonts, but the correct folder name is Resources/font.

    @slajalin From your logs it seems you have the same problem.

    Wednesday, February 28, 2018 2:39 PM
  • User132529 posted

    I met this issue in AppCenter, that is caused by AppCenter will use the old Android build tool to do the build. To solve this issue, you can add <AndroidSdkBuildToolsVersion>26.0.3</AndroidSdkBuildToolsVersion> into PropertyGroup

    Sunday, March 4, 2018 11:13 PM
  • User260144 posted

    I was experiencing the same problem; it wasn't working in Debug, but I would switch to Release and it would work.

    I tried deleting my obj + bin folders in my project, then redeployed Debug and it seems to work fine now.

    Friday, March 16, 2018 4:35 PM
  • User208615 posted

    @Jesse_Jiang - Can you explain why it works? Is it because AppCenter has an outdated build server?

    Friday, April 13, 2018 10:29 PM
  • User132529 posted

    @MichaelShapiro said: @JesseJiang - Can you explain why it works? Is it because AppCenter has an outdated build server?

    The root cause is AppCenter will use Android SDK 23(I forgot) as default one, the old SDK, don't support the font feature when building it. This line will make sure the App Center will use SDK 26.

    Sunday, April 15, 2018 11:00 PM
  • User170773 posted

    I resolved issue by adding build tools version 27.0.3 to my sdk location/build-tools. check the required build tools version in obj/debug/[compile-version]/build.props

    Sunday, January 13, 2019 8:03 AM
  • User114757 posted

    Android Project:

    Put image/font in Asset root folder. Open file properties and set Build Action as "AndroidAsset". Go Happy!

    Friday, September 27, 2019 7:46 PM
  • User330472 posted

    The solution is amazingly simple. This error is brought when accidentally you paste an image on the Resource folder. It´s Build Action will be defined by default as Android Resource when pasted on this folder, leading to this compilation error that you are seeing. Android resources such as fonts or other xmls should be on it´s corresponding subfolder of the Resource folder only, following Android conventions (drawable for images, font for fonts, etc)

    Thursday, January 30, 2020 12:19 AM