1

I have a Xamarin ListView with custom ViewCellRenderer. Until an Android 7.1 all works fine. From Android 8.0 this error occurs when I try to show the ListView.

Stack:

01-25 07:52:45.881 I/MonoDroid( 1796): UNHANDLED EXCEPTION: 01-25 07:52:45.884 I/MonoDroid( 1796): System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.ListViewAdapter from native handle 0xffb2ba4c (key_handle 0x12b402c). ---> System.MissingMethodException: No constructor found for Xamarin.Forms.Platform.Android.ListViewAdapter::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> J ava.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown. 01-25 07:52:45.884 I/MonoDroid( 1796): --- End of inner exception stack trace --- 01-25 07:52:45.884 I/MonoDroid( 1796): at Java.Interop.TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00054] in <8211f1f12f9e45838d631abf63e51c79>:0 01-25 07:52:45.884 I/MonoDroid( 1796): at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00111] in <8211f1f12f9e45838d631abf63e51c79>:0 01-25 07:52:45.884 I/MonoDroid( 1796): --- End of inner exception stack trace --- 01-25 07:52:45.884 I/MonoDroid( 1796): at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in <8211f1f12f9e45838d631abf63e51c79>:0 01-25 07:52:45.884 I/MonoDroid( 1796): at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in <8211f1f12f9e45838d631abf63e51c79>:0 01-25 07:52:45.884 I/MonoDroid( 1796): at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <8211f1f12f9e45838d631abf63e51c79>:0 01-25 07:52:45.884 I/MonoDroid( 1796): at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <8211f1f12f9e45838d631abf63e51c79>:0 01-25 07:52:45.884 I/MonoDroid( 1796): at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in <8211f1f12f9e45838d631abf63e51c79>:0 01-25 07:52:45.884 I/MonoDroid( 1796): at Android.Widget.BaseAdapter.n_GetCount (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in <8211f1f12f9e45838d631abf63e51c79>:0 01-25 07:52:45.884 I/MonoDroid( 1796): at (wrapper dynamic-method) System.Object:7deaaa48-5ec9-40a5-ae19-b84f06973113 (intptr,intptr) 01-25 07:52:45.888 W/zygote ( 1796): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable 01-25 07:52:45.890 D/Mono ( 1796): DllImport searching in: '__Internal' ('(null)'). 01-25 07:52:45.890 D/Mono ( 1796): Searching for 'java_interop_jnienv_throw'. 01-25 07:52:45.890 D/Mono ( 1796): Probing 'java_interop_jnienv_throw'. 01-25 07:52:45.890 D/Mono ( 1796): Found as 'java_interop_jnienv_throw'.

Unhandled Exception:

System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.ListViewAdapter from native handle 0xffb2ba4c (key_handle 0x12b402c).

This is a GIF about the problem: enter image description here

How can I solve this?

Thank you!

Rai Vu
  • 1,595
  • 1
  • 20
  • 30
Hikari
  • 589
  • 7
  • 29
  • Add the missing constructor. Kindly refer this [link](https://stackoverflow.com/questions/10593022/monodroid-error-when-calling-constructor-of-custom-view-twodscrollview/10603714#10603714) for further information. – Thamarai T Oct 11 '21 at 07:47

0 Answers0