Content load crash

The following exception is thrown whenever I attempt to load any Texture2d


background = Content.Load<Texture2D>("stars");


08-18 23:20:51.334 I/MonoDroid( 4469): UNHANDLED EXCEPTION:
08-18 23:20:51.338 I/MonoDroid( 4469): Microsoft.Xna.Framework.Content.ContentLoadException: Could not load stars asset as a non-content file! ---> Microsoft.Xna.Framework.Content.ContentLoadException: Opening stream error. ---> Java.IO.FileNotFoundException: Exception of type 'Java.IO.FileNotFoundException' was thrown.
08-18 23:20:51.338 I/MonoDroid( 4469):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/1978/f98871a9/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61 
08-18 23:20:51.338 I/MonoDroid( 4469):   at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00064] in /Users/builder/data/lanes/1978/f98871a9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:195 
08-18 23:20:51.338 I/MonoDroid( 4469):   at Android.Content.Res.AssetManager.Open (System.String fileName) [0x0004b] in /Users/builder/data/lanes/1978/f98871a9/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.Content.Res.AssetManager.cs:88 
08-18 23:20:51.338 I/MonoDroid( 4469):   at Microsoft.Xna.Framework.TitleContainer.OpenStream (System.String name) [0x00024] in <filename unknown>:0      08-18 23:20:51.338 I/MonoDroid( 4469):   at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x00017] in <filename unknown>:0 
08-18 23:20:51.338 I/MonoDroid( 4469):   --- End of managed exception stack trace ---

The image file is in the “Content” folder and has Build Action:Content, Copy to Output Directory: Copy if newer

I see the following in the build log:

1>C:\Users\#\documents\visual studio 2015\Projects\game\game\Content\stars.jpg : warning XA0101: @(Content) build action is not supported

How can I fix this?


On Android, the Build Action must be set to AndroidAsset. That’s just how Android works.

I have similar problems. What if i have resources Build Action set like “AndroidAsset”, and my ManagerTransitions class has this code:

buttonMagic.TextureButton = game.Content.Load<Texture2D>("controls/button_magic_x2");

breaking my app =(
I tried so much stuff. Adding “Content/” to address, making “button_magic_x2” into .xnb file
Changing code to

game.Content.RootDirectory = "Content/" + "controls/";
buttonMagic.TextureButton = game.Content.Load<Texture2D>("button_magic_x2");

yields same result: "Microsoft.Xna.Framework.Content.ContentLoadException: Could not load button_magic_x2 asset as a non-content file!: