I am interested in Xamarin and I search, how I can take a photo from camera without device's native camera application. And I found Camera2 API, then I search sample app and I found this sample app: https://learn.microsoft.com/en-us/samples/xamarin/monodroid-samples/android50-camera2basic/
It worked very well when I tried it in the foreground but it gives an error when I put it in the background.
How can I get it running in the background?
Camera2BasicFragment.cs codes: https://paste.ubuntu.com/p/CqDkyMx8qW/
Exceptions:
Exception image 1
Exception image 2
Exception Text:
{Java.Lang.IllegalStateException: CameraDevice was already closed at Java.Interop.JniEnvironment+InstanceMethods.CallIntMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in <dac4c5a4b77f4e61a5e6d9d3050dfb9f>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractInt32Method (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00014] in <dac4c5a4b77f4e61a5e6d9d3050dfb9f>:0 at Android.Hardware.Camera2.CameraCaptureSessionInvoker.Capture (Android.Hardware.Camera2.CaptureRequest request, Android.Hardware.Camera2.CameraCaptureSession+CaptureCallback listener, Android.OS.Handler handler) [0x0006e] in /Users/builder/azdo/_work/204/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-27/mcw/Android.Hardware.Camera2.CameraCaptureSession.cs:969 at Camera2Basic.Camera2BasicFragment.LockFocus () [0x00020] in C:\Users\Harun\Desktop\x\Camera2Basic\Camera2BasicFragment.cs:576 at Camera2Basic.Camera2BasicFragment.TakePicture () [0x00001] in C:\Users\Harun\Desktop\x\Camera2Basic\Camera2BasicFragment.cs:563 at Camera2Basic.Camera2BasicFragment.OnClick (Android.Views.View v) [0x00013] in C:\Users\Harun\Desktop\x\Camera2Basic\Camera2BasicFragment.cs:676 at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_v) [0x00010] in /Users/builder/azdo/_work/204/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-27/mcw/Android.Views.View.cs:2176 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.19(intptr,intptr,intptr) --- End of managed Java.Lang.IllegalStateException stack trace ---java.lang.IllegalStateException: CameraDevice was already closed at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:1997) at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:844) at android.hardware.camera2.impl.CameraDeviceImpl.capture(CameraDeviceImpl.java:741) at android.hardware.camera2.impl.CameraCaptureSessionImpl.capture(CameraCaptureSessionImpl.java:179) at crc64b678081366886b9e.Camera2BasicFragment.n_onClick(Native Method) at crc64b678081366886b9e.Camera2BasicFragment.onClick(Camera2BasicFragment.java:77) at android.view.View.performClick(View.java:5721) at android.widget.TextView.performClick(TextView.java:10936) at mono.java.lang.RunnableImplementor.n_run(Native Method) at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7406) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)}
Related
After updating Android's Support Libraries (v28.0+) to get targeted with monoandroid90, the app crashes sometimes with the stack trace I provided bellow. If there are breakpoints active this won't happen.
Different versions of Xamarin.Android were tested, the current one I'm using is the latest 9.4 that comes with the default vs19. I was not able to reproduce this on a fresh install of the vs17 with the default XA that comes with it (9.1.7.0)
The following stack trace shows the current problem I'm facing.
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () <0x00007>
at (wrapper runtime-invoke) <Module>.runtime_invoke_bool (object,intptr,intptr,intptr) [0x0002b] in <ff07eae8184a40a08e79049bbcb31a0e>:0
"Finalizer"08-06 16:26:25.748 E/mono (11487): Full thread dump:
"Thread Pool Worker" at <unknown> <0xffffffff>
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () <0x00007>
at (wrapper runtime-invoke) <Module>.runtime_invoke_bool (object,intptr,intptr,intptr) [0x0002b] in <ff07eae8184a40a08e79049bbcb31a0e>:0
"Debugger agent"
"Timer-Scheduler" at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Threading.WaitHandle.Wait_internal (intptr*,int,bool,int) <0x00007>
at System.Threading.WaitHandle.WaitOneNative (System.Runtime.InteropServices.SafeHandle,uint,bool,bool) [0x0001f] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.WaitHandle.InternalWaitOne (System.Runtime.InteropServices.SafeHandle,long,bool,bool) [0x00019] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.WaitHandle.WaitOne (long,bool) [0x00010] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.WaitHandle.WaitOne (int,bool) [0x0001d] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.WaitHandle.WaitOne (int) [0x00003] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.Timer/Scheduler.SchedulerThread () [0x00043] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.ThreadHelper.ThreadStart_Context (object) [0x0001f] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00073] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00004] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object) [0x0002f] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.ThreadHelper.ThreadStart () [0x00014] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x00067] in <ff07eae8184a40a08e79049bbcb31a0e>:0
"<unnamed thread>"
08-06 16:26:35.755 I/libc (11487): Requested dump for tid 11487 (ler.challengeme)
Anybody else has ever faced this issue and is aware of a possible solution?
We developed a xamarin forms android app, it's working in some devices and crashing in some devices --> the app will open, after the splash screen appears it is crashing.
It happens on few samsung devices
We found one google console log.
android.runtime.JavaProxyThrowable: at SanSmart.App.OnInitialized () [0x00254] in <ce58e5be75db448fa7eb95f3f96a4a6d>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <3a61d48d66dd458fa0b64990b6c8f8cc>:0
at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <3921e1c40bf740cab0f47696b3ad1282>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <3921e1c40bf740cab0f47696b3ad1282>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <3921e1c40bf740cab0f47696b3ad1282>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.36(intptr,intptr)
at mono.java.lang.RunnableImplementor.n_run (Native Method)
at mono.java.lang.RunnableImplementor.run (RunnableImplementor.java:30)
at android.os.Handler.handleCallback (Handler.java:873)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:6986)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1445)
I am using Xamarin Android Native to create a worker handler using postdelay to run some background data fetching from webservice, the handler would call a function every few seconds, but when the activity runs, the app crashes randomly, and the FATAL EXCEPTION stack trace did not specify where exactly the problem is and every time it just throw the same message: "android.runtime.JavaProxyThrowable: System.NotSupportedException: Unable to activate instance of type Java.Lang.Thread+RunnableImplementor from native handle"
Following is the detail stack-trace:
AndroidRuntime: FATAL EXCEPTION: main
Process: ..., PID: 23551
android.runtime.JavaProxyThrowable: System.NotSupportedException: Unable to activate instance of type Java.Lang.Thread+RunnableImplementor from native handle 0xffd76a6c (key_handle 0x5005665). ---> System.MissingMethodException: No constructor found for Java.Lang.Thread+RunnableImplementor::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
--- End of inner exception stack trace ---
at Java.Interop.TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00054] in <263adecfa58f4c449f1ff56156d886fd>:0
at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00111] in <263adecfa58f4c449f1ff56156d886fd>:0
--- End of inner exception stack trace ---
at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in <263adecfa58f4c449f1ff56156d886fd>:0
at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in <263adecfa58f4c449f1ff56156d886fd>:0
at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <263adecfa58f4c449f1ff56156d886fd>:0
at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <263adecfa58f4c449f1ff56156d886fd>:0
at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in <263adecfa58f4c449f1ff56156d886fd>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in <263adecfa58f4c449f1ff56156d886fd>:0
at (wrapper dynamic-method) System.Object.eac9d564-b7f8-4035-a2ff-b38fdb337e7b(intptr,intptr)
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
at android.os.Handler.handleCallback(Handler.java:794)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
Who has encounter the same before?
And how to resolve this issue?
Your help is so much appreciated.
I'm working on AzureStorage cloud solution provided by Xamarin.
https://developer.xamarin.com/guides/xamarin-forms/cloud-services/storage/azure-storage/
And this is what I got in GetContainer() method.
The type initializer for
'Microsoft.WindowsAzure.Storage.CloudStorageAccount' threw an
exception
I applied my connection string in the sample project and it worked, but not in my own project.
Has anyone ever faced this issue? Please help me.
Thanks in advance.
Error message :
System.TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.Storage.CloudStorageAccount' threw an exception. ---> System.NotImplementedException: The method or operation is not implemented.
at Microsoft.WindowsAzure.Storage.CloudStorageAccount.Setting (System.String name, System.String[] validValues) [0x00000] in <667a5fa37f124e50ab7a68ecb3437b13>:0
at Microsoft.WindowsAzure.Storage.CloudStorageAccount..cctor () [0x00000] in <667a5fa37f124e50ab7a68ecb3437b13>:0
--- End of inner exception stack trace ---
at MyTenantWorld.AzureStorage.GetContainer (MyTenantWorld.ContainerType containerType) [0x00020] in <9816076ee17d42efaf1050c5169a4310>:0
at MyTenantWorld.AzureStorage+<UploadFileAsync>d__3.MoveNext () [0x0001a] in <9816076ee17d42efaf1050c5169a4310>:0
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <3fd174ff54b146228c505f23cf75ce71>:0
at MyTenantWorld.SettingsPage+<SaveData>d__20.MoveNext () [0x00309] in <9816076ee17d42efaf1050c5169a4310>:0
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <3fd174ff54b146228c505f23cf75ce71>:0
at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <d855bac285f44dda8a0d8510b679b1e2>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0
at at (wrapper dynamic-method) System.Object:a4fed05a-cd7a-4756-85bb-5dd975374042 (intptr,intptr)
As the GetContainer method defined under AzureStorage.cs as follows:
static CloudBlobContainer GetContainer(ContainerType containerType)
{
var account = CloudStorageAccount.Parse(Constants.StorageConnection);
var client = account.CreateCloudBlobClient();
return client.GetContainerReference(containerType.ToString().ToLower());
}
It seems that the error was thrown by CloudStorageAccount.Parse, but from BergQuester's link about CloudStorageAccount.Parse, we could find that this error is not from the predictable exceptions.
From your stack trace, we could find the error was thrown at Setting(string name, params string[] validValues) from CloudStorageAccount.cs. I used WindowsAzure.Storage 8.3.0 and tested it under my BruceChen_Mobile.UWP project and PCL project, it could work as expected with my azure storage connection string.
I applied my connection string in the sample project and it worked, but not in my own project.
I would recommend you checking the packages between your application and the xamarin-forms-samples. Or you could provide a reproducible sample project for us to narrow this issue.
I fixed this issue on mine by adding a reference to the WindowsAzure.Storage nuget package from my native projects (not just in the PCL project), as it requires some native implementations that are defined in these references.
The following post looks similar to my issue, but ultimately it doesn't look exactly the same down to all the details, so I am calling that out to prevent claims that its the same.
I am following this monogame tutorial (currently on step 2) in Xamarin Studio:
When I run the resulting monogame app at the end of step 2 I get the following exception (pasted at the end) when I hit the line of code that attempts to load the player content. I have the player content file setup correctly AFAIK, its copied to the output folder, but I am assuming that its somehow not deployed correctly to the Andriod Virtual Machine (AVM), which I have not been able to figure out how to examine the deployed contents. I pulled up Android Monitor to explore the AVM and try to figure out where things are, but I haven't had any luck figuring that out... The file not found exception seems to be clear that what's running on the AVM isn't finding the content file... but I can't figure out how to correct that.
Any help would be appreciated, thanks!
The sources and project that I am having this issue with are here
The exception I am seeing is the following:
[MonoDroid] UNHANDLED EXCEPTION: Microsoft.Xna.Framework.Content.ContentLoadException: Could not load Graphics\player 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. [MonoDroid] at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00000] in :0 [MonoDroid] at Android.Content.Res.AssetManager.Open (System.String fileName) [0x00000] in :0 [MonoDroid] at Microsoft.Xna.Framework.TitleContainer.OpenStream (System.String name) [0x00000] in :0 [MonoDroid] at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x00000] in :0 [MonoDroid] --- End of managed exception stack trace --- [MonoDroid] java.io.FileNotFoundException: Content/Graphics/player.xnb [MonoDroid] at android.content.res.AssetManager.openAsset(Native Method) [MonoDroid] at android.content.res.AssetManager.open(AssetManager.java:315) [MonoDroid] at android.content.res.AssetManager.open(AssetManager.java:289) [MonoDroid] at mono.java.lang.RunnableImplementor.n_run(Native Method) [MonoDroid] at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29) [MonoDroid] at android.os.Handler.handleCallback(Handler.java:605) [MonoDroid] at android.os.Handler.dispatchMessage(Handler.java:92) [MonoDroid] at android.os.Looper.loop(Looper.java:137) [MonoDroid] at android.app.ActivityThread.main(ActivityThread.java:4424) [MonoDroid] at java.lang.reflect.Method.invokeNative(Native Method) [MonoDroid] at java.lang.reflect.Method.invoke(Method.java:511) [MonoDroid] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) [MonoDroid] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) [MonoDroid] at dalvik.system.NativeStart.main(Native Method) [MonoDroid] [MonoDroid] --- End of inner exception stack trace --- [MonoDroid] at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x00000] in :0 [MonoDroid] at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[Texture2D] (System.String assetName, System.Action1 recordDisposableObject) [0x00000] in :0
[MonoDroid] --- End of inner exception stack trace ---
[MonoDroid] at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset (string,System.Action1) <0x0042c> [MonoDroid] at Microsoft.Xna.Framework.Content.ContentManager.Load (string) <0x000c3> [MonoDroid] at SampleShooter.Game1.LoadContent () <0x0018b> [MonoDroid] at Microsoft.Xna.Framework.Game.Initialize () <0x0023f> [MonoDroid] at SampleShooter.Game1.Initialize () <0x00037> [MonoDroid] at Microsoft.Xna.Framework.Game.DoInitialize () <0x00037> [MonoDroid] at Microsoft.Xna.Framework.AndroidGamePlatform.BeforeUpdate (Microsoft.Xna.Framework.GameTime) <0x0002b> [MonoDroid] at Microsoft.Xna.Framework.Game.DoUpdate (Microsoft.Xna.Framework.GameTime) <0x0002f> [MonoDroid] at Microsoft.Xna.Framework.Game.Tick () <0x00493> [MonoDroid] at Microsoft.Xna.Framework.AndroidGameWindow.OnUpdateFrame (OpenTK.FrameEventArgs) <0x000a7> [MonoDroid] at OpenTK.Platform.Android.AndroidGameView.UpdateFrameInternal (OpenTK.FrameEventArgs) <0x00033> [MonoDroid] at OpenTK.Platform.Android.AndroidGameView.RunIteration (System.Threading.CancellationToken) <0x001c3> [MonoDroid] at OpenTK.Platform.Android.AndroidGameView/c__AnonStorey0.<>m__2 (object) <0x00027> [MonoDroid] at Android.App.SyncContext/c__AnonStorey2F.<>m__1A () <0x00023> [MonoDroid] at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f> [MonoDroid] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x00037> [MonoDroid] at (wrapper dynamic-method) object.e85befee-f4e0-4f15-9232-77621081c7b5 (intptr,intptr) <0x0003b> [mono] [mono] Unhandled Exception: [mono] Microsoft.Xna.Framework.Content.ContentLoadException: Could not load Graphics\player 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. [mono] at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00000] in :0 [mono] at Android.Content.Res.AssetManager.Open (System.String fileName) [0x00000] in :0 [mono] at Microsoft.Xna.Framework.TitleContainer.OpenStream (System.String name) [0x00000] in :0 [mono] at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x00000] in :0 [mono] --- End of managed exception stack trace --- [mono] java.io.FileNotFoundException: Content/Graphics/player.xnb [mono] at android.content.res.AssetManager.openAsset(Native Method) [mono] at android.content.res.AssetManager.open(AssetManager.ja [mono] [ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.Xna.Framework.Content.ContentLoadException: Could not load Graphics\player 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. [mono] at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00000] in :0 [mono] at Android.Content.Res.AssetManager.Open (System.String fileName) [0x00000] in :0 [mono] at Microsoft.Xna.Framework.TitleContainer.OpenStream (System.String name) [0x00000] in :0 [mono] at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x00000] in :0 [mono] --- End of managed exception stack trace --- [mono] java.io.FileNotFoundException: Content/Graphics/player.xnb [mono] at android.content.res.AssetManager.openAsset(Native Method) [mono] at android.content.res.AssetManager.open(As
So I finally figured out that I needed to mark the XNB file as an AndroidAsset for the build action, and not Content as the example stated. Since the example I am following is aimed at Windows Mobile development this makes sense since the file would normally be marked as content for a Windows application, whereas for Android these files need to be marked as AndriodAsset in order for XNA to be able to access the raw content data, regardless of if the file is in a content or asset folder. The content manager's root folder by default is "Content", so you need to add the file there and mark it as an asset, not content...
Content for an android monogame project should be added to the project in the Assets/Content folder as built .xnb files rather than just copied to the output directory