Android onResume doesn't seem to resume content

I downloaded code around 4/18 from git in order to fix the problem of sound not playing in the 4/7 3.2 release. However, now onResume doesn’t seem to reload textures. They’re all black. What can I do at this point?

Thank you for your help.

-Nick

Please try using the very latest in the develop branch from Github. I think @daveleaver made a change in this area recently.

Can you confirm that in the 4/7 3.2 release your textures were being reloaded correctly?

Since that time, have you updated only the MonoGame code or could something else have changed (eg updated your Xamarin.Android version)?

My change was merged 7 days ago:

This should have fixed this issue

Moving to the latest build fixed it.

Glad to hear this has fixed it :slight_smile:

Hi,

I am currently in developer hell with this issue and would really appreciate any help.

Things were working fine in my Android app with pause/resume (once I’d written my own code to recreate RenderTarget2Ds and images created from streams). Now all my textures loaded with Content.Load are going black on resume, though the stuff I recreate myself is still working fine.

To the best of my knowledge I haven’t updated anything, though it’s possible there’s been a Xamarin update since I last tested this aspect of things. I am running on the version of Monogame Android shipped with Xamarin.

I have tried to download and compile the latest MonoGame Android version but am getting all sort of errors - a bit of Googling indicates that most of these errors are due to compiling against a .net version less than 4.5, however when I try and set a target framework of 4.5 I am told that MonoDroid won’t support it.

I have attached the compile errors below. Any help appreciated - or if anyone can mail me a version of the MonoGame Android dll with these issues definitely fixed that would be much appreciated.

cheers

===== build output

/Volumes/Docs/development/Xamarin/MonoGame-3.2/MonoGame.Framework/MonoGame.Framework.Android.csproj (Build) ->
/Library/Frameworks/Mono.framework/Versions/3.2.6/lib/mono/4.0/Microsoft.CSharp.Targets (CoreCompile target) ->

Content/ContentExtensions.cs(13,39): error CS1110: `Microsoft.Xna.Framework.Content.ContentExtensions.GetDefaultConstructor(this System.Type)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Content/ContentExtensions.cs(25,38): error CS1110: `Microsoft.Xna.Framework.Content.ContentExtensions.GetAllProperties(this System.Type)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Content/ContentExtensions.cs(50,35): error CS1110: `Microsoft.Xna.Framework.Content.ContentExtensions.GetAllFields(this System.Type)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Game.cs(621,33): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Game.cs(630,33): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Game.cs(864,30): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Game.cs(865,30): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Game.cs(866,30): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Game.cs(867,30): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Game.cs(871,17): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Game.cs(872,17): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Game.cs(874,17): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Game.cs(875,17): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Game.cs(901,56): error CS0305: Using the generic type `System.Action<T>' requires `1' type argument(s)
Android/AndroidGameActivity.cs(97,41): error CS1110: `Microsoft.Xna.Framework.ActivityExtensions.GetActivityAttribute(this Microsoft.Xna.Framework.AndroidGameActivity)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(45,27): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.OpenGLNumberOfElements(this Microsoft.Xna.Framework.Graphics.VertexElementFormat)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(89,41): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.OpenGLVertexPointerType(this Microsoft.Xna.Framework.Graphics.VertexElementFormat)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(133,41): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.OpenGLVertexAttribPointerType(this Microsoft.Xna.Framework.Graphics.VertexElementFormat)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(179,28): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.OpenGLVertexAttribNormalized(this Microsoft.Xna.Framework.Graphics.VertexElement)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(203,40): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.OpenGLColorPointerType(this Microsoft.Xna.Framework.Graphics.VertexElementFormat)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(249,40): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.OpenGLNormalPointerType(this Microsoft.Xna.Framework.Graphics.VertexElementFormat)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(295,42): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.OpenGLTexCoordPointerType(this Microsoft.Xna.Framework.Graphics.VertexElementFormat)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(342,35): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.GetBlendEquationMode(this Microsoft.Xna.Framework.Graphics.BlendFunction)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(368,35): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.GetBlendFactorSrc(this Microsoft.Xna.Framework.Graphics.Blend)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(407,36): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.GetBlendFactorDest(this Microsoft.Xna.Framework.Graphics.Blend)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(447,24): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.GetGLFormat(this Microsoft.Xna.Framework.Graphics.SurfaceFormat, out OpenTK.Graphics.ES20.All, out OpenTK.Graphics.ES20.All, out OpenTK.Graphics.ES20.All)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(621,27): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.GetFrameLatency(this Microsoft.Xna.Framework.Graphics.PresentInterval)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(636,27): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.Size(this Microsoft.Xna.Framework.Graphics.SurfaceFormat)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Graphics/GraphicsExtensions.cs(679,27): error CS1110: `Microsoft.Xna.Framework.Graphics.GraphicsExtensions.GetTypeSize(this Microsoft.Xna.Framework.Graphics.VertexElementFormat)': Extension methods require `System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference?
Threading.cs(68,21): error CS1684: Reference to type `System.Action' claims it is defined assembly `mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', but it could not be found

---------------------- Done ----------------------

How did you create your project/solution files?
If you’ve made them manually, you should run protobuild to make them.

Maybe you don’t have the Android SDK version installed that you are trying to use to build?
I haven’t seen this error yet.

Thanks very much - creating the solution files with ProtoBuild sorted it, I was just copying the new Android files over to my 3.2 solution (and adding MonoGameAndroidGameView).

cheers

Can anybody explain to me what ProtoBuild is? I have very same problem, tried various paths and now I’m really frustrated.

any help is appreciated, cheers

Protobuild is a project generation program for C# projects. If you run protobuild in the root of monogame, it will create all the sln and csproj files for you. See https://github.com/hach-que/Protobuild