Cannot load spritefont in Monogame Android

Hi All,

I am porting my game which I made first as a Monogame Windows Universal to Monogame Android.
Please note that everything works perfectly in the Windows Universal project, the same is not working in the Android project.
It is really strange, I add all my content to the Pipeline tool and convert them as usual, then the game loads all the content, and there is no issue with Pictures, Music, Models, etc, but with the one and only spritefont file I have. I receive the:
“Microsoft.Xna.Framework.Content.ContentLoadException: Could not load font.xnb asset as a non-content file!” error message at this line: “game.Content.Load(“font”);”
I also tried “font.xnb”, but in the windows version, “font” is enough.
The font.spritefont file is added properly in the Pipeline tool, it produces the font.xnb file, all letters are small letters, no capital ones, so that cannot be the problem. I even added the font.xnb file in visual studio as an existing content and chose “Android Asset” and “Copy always” but still, when I start the game, I receive this error.

Do you guys have any idea?

Did you check the inner exception? Perhaps it has additional information.

Oh, yes:

  •   InnerException	{Java.IO.FileNotFoundException}	Java.IO.FileNotFoundException

-> I got this error when I tried Monogame for the very very fist time and I was a total beginner, that was a year ago. It is really strange, every other content is perfectly loaded. I have just commented out the lines in my game where I would use the spritefont and the game works perfectly with around 350 content files.

Is Android a case sensitive OS? Is the file actually “Font” and not “font”?

Android is case sensitive so you need to make sure the case is absolutely correct. Make sure the xnb extension on the file is lowercase as well.

Well, good question, developing for Android on Windows, when would the case sensitive part come into the picture, I have no idea, but everything is with small letters, I checked of course. Everything everywhere is lowercase.

I had simmilar problem with my game. And sometimes I still have. It might sound silly but I sometimes change the order of things to load and then everything works fine. I think it makes the project rebuild itself. Try cleaning solution too.
I have all my xnb files linked and set to AndroidAsset, which you’ve already done.
My Content.mgcb’s file build action is set to “MonoGameContentReference”.

Did you try different devices (my problem occured on some emulators/devices but not on others)?