android.runtime.JavaProxyThrowable: System.ObjectDisposedException: Cannot access a disposed object - xamarin

Every time I launch my Xamarin form app, it gives me the following exception and crashes.
. It keeps crashing even after restarting the app. I had to uninstall and reinstall the app.
After that, the application works fine without any code changes, but once this exception occurs, I have to reinstall it.
7-29 22:34:26.291 4590 4590 I MonoDroid: UNHANDLED EXCEPTION:
07-29 22:34:26.295 4590 4590 I MonoDroid: Android.Runtime.JavaProxyThrowable: Exception of type 'Android.Runtime.JavaProxyThrowable' was thrown.
07-29 22:34:26.296 4590 4590 I MonoDroid: --- End of managed Android.Runtime.JavaProxyThrowable stack trace ---
07-29 22:34:26.296 4590 4590 I MonoDroid: android.runtime.JavaProxyThrowable: System.ObjectDisposedException: Cannot access a disposed object.
07-29 22:34:26.296 4590 4590 I MonoDroid: Object name: 'Xamarin.Forms.Platform.Android.ShellFlyoutRenderer'.
07-29 22:34:26.296 4590 4590 I MonoDroid: at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in :0
07-29 22:34:26.296 4590 4590 I MonoDroid: at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in :0
07-29 22:34:26.296 4590 4590 I MonoDroid: at Android.Views.View.Post (Java.Lang.IRunnable action) [0x00036] in <1db5751744294c2d9a12968f7500aa0a>:0
07-29 22:34:26.296 4590 4590 I MonoDroid: at Android.Views.View.Post (System.Action action) [0x00008] in <1db5751744294c2d9a12968f7500aa0a>:0
07-29 22:34:26.296 4590 4590 I MonoDroid: at Xam.Shell.Badge.Droid.Renderers.BadgeShellItemRenderer.b__7_0 () [0x0000b] in <03ed10528a1e495baf36a579de381653>:0
07-29 22:34:26.296 4590 4590 I MonoDroid: at Xamarin.Forms.Device+<>c__DisplayClass42_0`1[T].b__0 () [0x00000] in <62e3629c74b84e3d834046331d2bb5f8>:0
07-29 22:34:26.296 4590 4590 I MonoDroid: --- End of stack trace from previous location where exception was thrown ---
Environment :
Xamarin form:5.0.0.2401
target Os: android 8.1
editor: vs studio 2022 professional

Related

No constructor found in exception but class has the exact constructor

I am sometimes getting the following exception:
Unhandled Exception: Android.Runtime.JavaProxyThrowable: Exception of type 'Android.Runtime.JavaProxyThrowable' was thrown.
--- End of managed Android.Runtime.JavaProxyThrowable stack trace ---
android.runtime.JavaProxyThrowable: System.NotSupportedException: Unable to activate instance of type TaxiTabletUniversal.Droid.Views.SoftMeterView from native handle 0xbe8cfb2c (key_handle 0x369e8281). ---> System.MissingMethodException: No constructor found for TaxiTabletUniversal.Droid.Views.SoftMeterView::.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 <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00111] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
--- End of inner exception stack trace ---
at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Android.Views.ViewTreeObserver+IOnGlobalLayoutListenerInvoker.n_OnGlobalLayout (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at (wrapper dynamic-method) System.Object.90422e09-526e-4347-b02e-8c2980bde53e(intptr,intptr)
at mvvmcross.droid.views.MvxActivity.n_onGlobalLayout(Native Method)
at mvvmcross.droid.views.MvxActivity.onGlobalLayout(MvxActivity.java:84)
at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:986)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2221)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1306)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7031)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:821)
at android.view.Choreographer.doCallbacks(Choreographer.java:606)
at android.view.Choreographer.doFrame(Choreographer.java:576)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:807)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6914)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
with the bit that stands out from that exception saying :
No constructor found for TaxiTabletUniversal.Droid.Views.SoftMeterView::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership)
But the class SoftmeterView (derived from MvxActivity) does have 2 constructors:
public SoftMeterView() : base()
{
MoveTaskToBack(true);
IsCreated = true;
}
with the second one matching the exact signature the exception is complaining about:
public SoftMeterView(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
MoveTaskToBack(true);
IsCreated = true;
}
any thoughts ?

Unhandled Exception while Get a Response from Web API in Xamarin android

I am creating my first xamarin project with PCL .
I have created WebApi2 with Get Response and publish on my local server which works fine and provides the JSON response correctly
URL : http://test.propertytaxapi.com/api/ward
response :
[{"id":1,"zone_id":1,"ward_no":"1"},{"id":2,"zone_id":1,"ward_no":"2"},{"id":3,"zone_id":1,"ward_no":"3"},{"id":4,"zone_id":1,"ward_no":"4"},{"id":5,"zone_id":1,"ward_no":"5"},{"id":6,"zone_id":1,"ward_no":"6"}]
but when i tried to implement this in my Xamarin project and call it like.
public async Task<List<Ward>> GetData()
{
using (var client = new HttpClient())
{
try
{
client.BaseAddress = new Uri("http://test.propertytaxapi.com/api");
var response = await client.GetAsync("ward");
response.EnsureSuccessStatusCode();
var placesJson = response.Content.ReadAsStringAsync().Result;
Ward wardData = new Ward();
if (placesJson != "")
{
var wlists= JsonConvert.DeserializeObject<List<Ward>>(placesJson);
wardList = wlists.ToList();
}
}
catch (Exception)
{
return null;
}
}
return wardList;
}
I got the exception on this line :-
var response = await client.GetAsync("ward");
Exception:
11-02 14:11:29.968 E/mono ( 2954):
11-02 14:11:29.968 E/mono ( 2954): Unhandled Exception:
11-02 14:11:29.968 E/mono ( 2954): System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: NameResolutionFailure
11-02 14:11:29.968 E/mono ( 2954): at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in <6c708cf596db438ebfc6b7e012659eee>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): --- End of stack trace from previous location where exception was thrown ---
11-02 14:11:29.968 E/mono ( 2954): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Net.Http.HttpClientHandler+<SendAsync>d__63.MoveNext () [0x00450] in <7736395a6c71409691a34accfc621095>:0
11-02 14:11:29.968 E/mono ( 2954): --- End of inner exception stack trace ---
11-02 14:11:29.976 E/mono-rt ( 2954): [ERROR] FATAL UNHANDLED EXCEPTION: System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: NameResolutionFailure
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in <6c708cf596db438ebfc6b7e012659eee>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): --- End of stack trace from previous location where exception was thrown ---
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Net.Http.HttpClientHandler+d__63.MoveNext () [0x00450] in <7736395a6c71409691a34accfc621095>:0
11-02 14:11:29.976 E/mono-rt ( 2954): --- End of inner exception stack trace ---
Please suggest me the solution to get response
client.BaseAddress = new Uri("http://test.propertytaxapi.com/api/");
Add backslash at the end of Base address. Try the above uri

Handle Must Be Valid Exception Xamarin

I am working on an android app using Xamarin and receive the following exception.
Xamarin caused by: android.runtime.JavaProxyThrowable: System.ArgumentException: Handle must be valid.
Parameter name: instance
at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0000d] in <1bc3ec2e392f4f1a8cde1c9a163d2a4a>:0
at Android.Runtime.JNIEnv.CallVoidMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in <0ce7e7a03dfb4c4b87eaf38b0e480d65>:0
at Android.Support.V4.Widget.SwipeRefreshLayout.set_Refreshing (System.Boolean value) [0x00060] in <27c17fe440cf491ba8255bcefade6e02>:0
at Xamarin.Forms.Platform.Android.ListViewRenderer.<UpdateIsRefreshing>b__25_0 () [0x00000] in <a3e44144fef249b0888b761605dfca24>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in <0ce7e7a03dfb4c4b87eaf38b0e480d65>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <0ce7e7a03dfb4c4b87eaf38b0e480d65>:0
at (wrapper dynamic-method) System.Object:ffc21647-8320-4065-b329-c8e7939eb92d (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:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I've tried adding a txt file, environment.txt, with the property to set the GC to old. However that did not work.
What other issues could cause this exception?

Xamarin.Android using MvvmCross crashes on Activity launch

I am currently developing a Xamarin app and all of a sudden my Android app started crashing on LoginActivity. I have researched a lot on "
Java.Lang.ClassNotFoundException: Didn't find class
"android.support.v7.appcompat.R$styleable" on path
"
Tried things like updating Android SDK, deleting bin and obj folder. Looking at stacktrace it seems to be an issue with MvvmCross. Currently I am using 3.5.1 of MvvmCross.
Another fact is that I am the only one in team who is facing this issue.
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.Lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable; ---> Java.Lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/org.cancer.fundraising-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cancer.fundraising-1/lib/x86, /vendor/lib, /system/lib]]
[MonoDroid] --- End of managed exception stack trace ---
[MonoDroid] java.lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/org.cancer.fundraising-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cancer.fundraising-1/lib/x86, /vendor/lib, /system/lib]]
[MonoDroid] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[MonoDroid] at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:118)
[MonoDroid] at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
[MonoDroid] at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
[MonoDroid] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.n_onCreate(Native Method)
[MonoDroid] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.onCreate(LoginActivity.java:31)
[MonoDroid] at android.app.Activity.performCreate(Activity.java:5990)
[MonoDroid] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
[MonoDroid] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
[MonoDroid] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
[MonoDroid] at android.app.ActivityThread.access$800(ActivityThread.java:151)
[MonoDroid] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
[MonoDroid] at android.os.Handler.dispatchMessage(Handler.java:102)
[MonoDroid] at android.os.Looper.loop(Looper.java:135)
[MonoDroid] at android.app.ActivityThread.main(ActivityThread.java:5254)
[MonoDroid] at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid] at java.lang.reflect.Method.invoke(Method.java:372)
[MonoDroid] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[MonoDroid] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[MonoDroid] Suppressed: java.lang.ClassNotFoundException: android.support.v7.appcompat.R$styleable
[MonoDroid] at java.lang.Class.classForName(Native Method)
[MonoDroid] at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[MonoDroid] at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[MonoDroid] ... 19 more
[MonoDroid] Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
[MonoDroid] --- End of inner exception stack trace ---
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0xa047bf80 + 0x0002b> in <filename unknown>:0
[MonoDroid] at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) <0xa2007008 + 0x000b3> in <filename unknown>:0
[MonoDroid] at Android.App.Activity.OnCreate (Android.OS.Bundle savedInstanceState) <0xa1018918 + 0x0014f> in <filename unknown>:0
[MonoDroid] at ACS.FundRaising.Android.MvxActionBarEventSourceActivity.OnCreate (Android.OS.Bundle bundle) <0xa047b4e0 + 0x00037> in <filename unknown>:0
[MonoDroid] at ACS.FundRaising.Android.LoginActivity.OnCreate (Android.OS.Bundle bundle) <0xa047b278 + 0x0001b> in <filename unknown>:0
[MonoDroid] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) <0xa116f9b0 + 0x00057> in <filename unknown>:0
[MonoDroid] at (wrapper dynamic-method) System.Object:dd5e6f9d-f207-497c-b5c3-0a2c9dac76e7 (intptr,intptr,intptr)
[MonoDroid] --- End of managed exception stack trace ---
[MonoDroid] java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable;
[MonoDroid] at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:118)
[MonoDroid] at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
[MonoDroid] at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
[MonoDroid] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.n_onCreate(Native Method)
[MonoDroid] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.onCreate(LoginActivity.java:31)
[MonoDroid] at android.app.Activity.performCreate(Activity.java:5990)
[MonoDroid] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
[MonoDroid] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
[MonoDroid] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
[MonoDroid] at android.app.ActivityThread.access$800(ActivityThread.java:151)
[MonoDroid] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
[MonoDroid] at android.os.Handler.dispatchMessage(Handler.java:102)
[MonoDroid] at android.os.Looper.loop(Looper.java:135)
[MonoDroid] at android.app.ActivityThread.main(ActivityThread.java:5254)
[MonoDroid] at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid] at java.lang.reflect.Method.invoke(Method.java:372)
[MonoDroid] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[MonoDroid] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[MonoDroid] Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/org.cancer.fundraising-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cancer.fundraising-1/lib/x86, /vendor/lib, /system/lib]]
[MonoDroid] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[MonoDroid] ... 18 more
[MonoDroid] Suppressed: java.lang.ClassNotFoundException: android.support.v7.appcompat.R$styleable
[MonoDroid] at java.lang.Class.classForName(Native Method)
[MonoDroid] at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[MonoDroid] at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[MonoDroid] ... 19 more
[MonoDroid] Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
[Mono] Assembly Ref addref GoogleAnalytics.Core[0xb429abe0] -> System.Net.Http[0xaed233a0]: 3
[Mono] Assembly Ref addref GoogleAnalytics.Core[0xb429abe0] -> System.Core[0xb4387580]: 7
[Mono] Assembly Ref addref System.Net.Http[0xaed233a0] -> System[0xb4387760]: 10
[Mono] Assembly Ref addref System.Net.Http[0xaed233a0] -> System.Core[0xb4387580]: 8
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable; ---> Java.Lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/org.cancer.fundraising-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cancer.fundraising-1/lib/x86, /vendor/lib, /system/lib]]
[mono-rt]
[mono-rt] --- End of managed exception stack trace ---
[mono-rt] java.lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/org.cancer.fundraising-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cancer.fundraising-1/lib/x86, /vendor/lib, /system/lib]]
[mono-rt] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[mono-rt] at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[mono-rt] at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[mono-rt] at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:118)
[mono-rt] at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
[mono-rt] at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
[mono-rt] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.n_onCreate(Native Method)
[mono-rt] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.onCreate(LoginActivity.java:31)
[mono-rt] at android.app.Activity.performCreate(Activity.java:5990)
[mono-rt] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
[mono-rt] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
[mono-rt] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
[mono-rt] at android.app.ActivityThread.access$800(ActivityThread.java:151)
[mono-rt] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
[mono-rt] at android.os.Handler.dispatchMessage(Handler.java:102)
[mono-rt] at android.os.Looper.loop(Looper.java:135)
[mono-rt] at android.app.ActivityThread.main(ActivityThread.java:5254)
[mono-rt] at java.lang.reflect.Method.invoke(Native Method)
[mono-rt] at java.lang.reflect.Method.invoke(Method.java:372)
[mono-rt] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[mono-rt] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[mono-rt] Suppressed: java.lang.ClassNotFoundException: android.support.v7.appcompat.R$styleable
[mono-rt] at java.lang.Class.classForName(Native Method)
[mono-rt] at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[mono-rt] at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[mono-rt] at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[mono-rt] ... 19 more
[mono-rt] Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
[mono-rt]
[mono-rt] --- End of inner exception stack trace ---
[mono-rt] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0xa047bf80 + 0x0002b> in <filename unknown>:0
[mono-rt] at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) <0xa2007008 + 0x000b3> in <filename unknown>:0
[mono-rt] at Android.App.Activity.OnCreate (Android.OS.Bundle savedInstanceState) <0xa1018918 + 0x0014f> in <filename unknown>:0
[mono-rt] at ACS.FundRaising.Android.MvxActionBarEventSourceActivity.OnCreate (Android.OS.Bundle bundle) <0xa047b4e0 + 0x00037> in <filename unknown>:0
[mono-rt] at ACS.FundRaising.Android.LoginActivity.OnCreate (Android.OS.Bundle bundle) <0xa047b278 + 0x0001b> in <filename unknown>:0
[mono-rt] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) <0xa116f9b0 + 0x00057> in <filename unknown>:0
[mono-rt] at (wrapper dynamic-method) System.Object:dd5e6f9d-f207-497c-b5c3-0a2c9dac76e7 (intptr,intptr,intptr)
[mono-rt] --- End of managed exception stack trace ---
[mono-rt] java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable;
[mono-rt] at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:118)
[mono-rt] at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
[mono-rt] at android.support.v7.app.AppCompatActivity.onCreate(AppCompa
In my case a solution Clean was necessary to get it working.
This issue is resolved by Re-Cloning the repository. Still I don't know what caused the issue but I ended up wasting lot of time. I tried things like;
Removing and downloading packages
Deleting Obj/Bin
Deleting appcompat from android SDK install folder and re-downloading it
Using component instead of package
Probably build output generated some garbage resulting in such issue.

Why do I get this error in Release build: This type is not supported on this platform INullableConverterFactory

Using Xamarin XS v5.5, AutoMapper v3.2.1,
I get this runtime error in Release build (not in Debug):
This type is not supported on this platform INullableConverterFactory
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException:
An exception was thrown by the type initializer for AutoMapper.Mappers.MapperRegistry --->
System.TypeInitializationException:
An exception was thrown by the type initializer for AutoMapper.Mappers.EnumMapper --->
System.PlatformNotSupportedException: This type is not supported on this platform INullableConverterFactory
[mono-rt] at AutoMapper.Internal.PlatformAdapter.Resolve[INullableConverterFactory] (Boolean throwIfNotFound) [0x00000] in <filename unknown>:0
[mono-rt] at AutoMapper.Mappers.EnumMapper..cctor () [0x00000] in <filename unknown>:0
[mono-rt] --- End of inner exception stack trace ---
[mono-rt] at AutoMapper.Mappers.MapperRegistry..cctor () [0x00000] in <filename unknown>:0
[mono-rt] --- End of inner exception stack trace ---
[mono-rt] at AutoMapper.Mapper.Reset () [0x00000] in <filename unknown>:0
[mono-rt] at AutoMapper.Mapper.Initialize (System.Action`1 action) [0x00000] in <filename unknown>:0
[mono-rt] at MyApp.Android.MainActivity.ConfigMapper () [0x00000] in <filename unknown>:0
[mono-rt] at MyApp.Android.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00000] in <filename unknown>:0
[mono-rt] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00000] in <filename unknown>:0
[mono-rt] at (wrapper dynamic-method) object:3cc570cf-1f33-4513-b6e4-0e910820d0ba (intptr,intptr,intptr)
What could the issue be?
It's most likely the linker removing that type from the AutoMapper assembly..
Usually RELEASE mode has the linker set to SDK Assemblies or ALL Assemblies where as DEBUG doesn't do any linking
Check here how to modify what's linked
https://developer.xamarin.com/guides/cross-platform/advanced/custom_linking/
I had the same exception and adding this fellow in fixed it
<assembly fullname="AutoMapper">
<type fullname="*INullableConverterFactory*" />
<type fullname="*MappingExpression*" />
</assembly>

Resources