xamarin.forms(Android)中的DefaultRenderer错误

问题描述 投票:23回答:1

我正在使用xamarin表单...有时当我尝试返回上一页时,我看到此内容(Android设备:):

System.NotSupportedException:无法从本机句柄0xbeb4a30c激活Xamarin.Forms.Platform.Android.Platform + DefaultRenderer类型的实例

我在标签渲染器和盒子渲染器中看到了相同的问题,但我通过在自定义渲染器中创建构造函数来解决此问题,如下面的链接所示:

MonoDroid: Error when calling constructor of custom view - TwoDScrollView

但是关于DefaultRenderer错误没有任何信息,因为最近30天内我一直在其中搜索...我越来越疯狂了...

完整例外:

System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.Platform+DefaultRenderer from native handle 0xbecdf3ac (key_handle 0x24da7695).

04-04 11:51:53.914 D/Mono    (30832): DllImport attempting to load: '/system/lib/liblog.so'. 04-04 11:51:53.914 D/Mono    (30832): DllImport loaded library '/system/lib/liblog.so'. 04-04 11:51:53.914 D/Mono    (30832): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so'). 04-04 11:51:53.914 D/Mono    (30832): Searching for '__android_log_print'. 04-04 11:51:53.914 D/Mono    (30832): Probing '__android_log_print'. 04-04 11:51:53.914 D/Mono    (30832): Found as '__android_log_print'. 04-04 11:51:53.924 I/MonoDroid(30832): UNHANDLED EXCEPTION: 04-04 11:51:53.944 I/MonoDroid(30832): System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.Platform+DefaultRenderer from native handle 0xbecdf3ac (key_handle 0x24da7695). ---> System.MissingMethodException: No constructor found for Xamarin.Forms.Platform.Android.Platform+DefaultRenderer::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown. 04-04 11:51:53.944 I/MonoDroid(30832):    --- End of inner exception stack trace --- 04-04 11:51:53.944 I/MonoDroid(30832):   at Java.Interop.TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00054] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:51:53.944 I/MonoDroid(30832):   at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00111] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:51:53.944 I/MonoDroid(30832):    --- End of inner exception stack trace --- 04-04 11:51:53.944 I/MonoDroid(30832):   at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:51:53.944 I/MonoDroid(30832):   at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:51:53.944 I/MonoDroid(30832):   at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:51:53.944 I/MonoDroid(30832):   at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:51:53.944 I/MonoDroid(30832):   at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:51:53.944 I/MonoDroid(30832):   at Android.Views.View.n_DispatchTouchEvent_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e) [0x00000] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:51:53.944 I/MonoDroid(30832):   at (wrapper dynamic-method) System.Object:cce836e4-e6e4-4d51-a0da-36412953d80b (intptr,intptr,intptr) 04-04 11:51:53.964 W/art     (30832): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable 04-04 11:51:53.964 D/Mono    (30832): DllImport searching in: '__Internal' ('(null)'). 04-04 11:51:53.964 D/Mono    (30832): Searching for 'java_interop_jnienv_throw'. 04-04 11:51:53.964 D/Mono    (30832): Probing 'java_interop_jnienv_throw'. 04-04 11:51:53.964 D/Mono    (30832): Found as 'java_interop_jnienv_throw'. Unhandled Exception:

System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.Platform+DefaultRenderer from native handle 0xbecdf3ac (key_handle 0x24da7695).

04-04 11:51:57.014 I/art     (30832): Thread[2,tid=30839,WaitingInMainSignalCatcherLoop,Thread*=0xaf90e400,peer=0x12c4d080,"Signal Catcher"]: reacting to signal 3 04-04 11:51:57.584 I/art     (30832): Wrote stack traces to '/data/anr/traces.txt' 04-04 11:52:07.844 I/MonoDroid(30832): UNHANDLED EXCEPTION: 04-04 11:52:07.894 I/MonoDroid(30832): System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.Platform+DefaultRenderer from native handle 0xbecdf3ac (key_handle 0x24da7695). ---> System.MissingMethodException: No constructor found for Xamarin.Forms.Platform.Android.Platform+DefaultRenderer::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown. 04-04 11:52:07.894 I/MonoDroid(30832):    --- End of inner exception stack trace --- 04-04 11:52:07.894 I/MonoDroid(30832):   at Java.Interop.TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00054] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:52:07.894 I/MonoDroid(30832):   at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00111] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:52:07.894 I/MonoDroid(30832):    --- End of inner exception stack trace --- 04-04 11:52:07.894 I/MonoDroid(30832):   at (wrapper dynamic-method) System.Object:cce836e4-e6e4-4d51-a0da-36412953d80b (intptr,intptr,intptr) 04-04 11:52:07.894 I/MonoDroid(30832):   at (wrapper managed-to-native) Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_void_method_a (intptr,intptr&,intptr,intptr,intptr,Java.Interop.JniArgumentValue*) 04-04 11:52:07.894 I/MonoDroid(30832):   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00073] in <e8c0e16a54534fa885244f0ad837c79e>:0  04-04 11:52:07.894 I/MonoDroid(30832):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <e8c0e16a54534fa885244f0ad837c79e>:0  04-04 11:52:07.894 I/MonoDroid(30832):   at Android.Views.ViewGroup.RemoveAllViews () [0x0000a] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:52:07.894 I/MonoDroid(30832):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Dispose (System.Boolean disposing) [0x00088] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:238 04-04 11:52:07.894 I/MonoDroid(30832):   at Java.Lang.Object.Dispose () [0x00000] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:52:07.894 I/MonoDroid(30832):   at Xamarin.Forms.Platform.Android.ListViewRenderer.ClearRenderer (Android.Views.View renderedView) [0x00032] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewRenderer.cs:295 04-04 11:52:07.894 I/MonoDroid(30832):   at Xamarin.Forms.Platform.Android.ListViewRenderer.Dispose (System.Boolean disposing) [0x0001e] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewRenderer.cs:59 04-04 11:52:07.894 I/MonoDroid(30832):   at Java.Lang.Object.Dispose () [0x00000] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:52:07.894 I/MonoDroid(30832):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Dispose (System.Boolean disposing) [0x0007b] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:234 04-04 11:52:07.894 I/MonoDroid(30832):   at Java.Lang.Object.Dispose () [0x00000] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:52:07.894 I/MonoDroid(30832):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Dispose (System.Boolean disposing) [0x0007b] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:234 04-04 11:52:07.894 I/MonoDroid(30832):   at Xamarin.Forms.Platform.Android.PageRenderer.Dispose (System.Boolean disposing) [0x00011] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\Renderers\PageRenderer.cs:33 04-04 11:52:07.894 I/MonoDroid(30832):   at Java.Lang.Object.Dispose () [0x00000] in <e79c73bcbbb547688bef6c7e9665c95e>:0  04-04 11:52:07.894 I/MonoDroid(30832):   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnDestroyView () [0x0003c] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:91 04-04 11:52:07.894 I/MonoDroid(30832):   at Android.Support.V4.App.Fragment.n_OnDestroyView (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <1e89c43d3c7d48b5ba69bfc0b1bdf114>:0  04-04 11:52:07.894 I/MonoDroid(30832):   at (wrapper dynamic-method) System.Object:1df32498-cacf-4686-8c6a-cd4a5d878faf (intptr,intptr) 04-04 11:52:07.914 E/mono-rt (30832): Stacktrace: 04-04 11:52:07.914 E/mono-rt (30832):  04-04 11:52:07.914 E/mono-rt (30832):   at <unknown> <0xffffffff> 04-04 11:52:07.914 E/mono-rt (30832):   at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_new_string (intptr,intptr&,char*,int) <0x00043> 04-04 11:52:07.914 E/mono-rt (30832):   at Java.Interop.JniEnvironment/Strings.NewString (char*,int) [0x00009] in <e8c0e16a54534fa885244f0ad837c79e>:0 04-04 11:52:07.924 E/mono-rt (30832):   at Java.Interop.JniEnvironment/Strings.NewString (string) [0x00024] in <e8c0e16a54534fa885244f0ad837c79e>:0 04-04 11:52:07.924 E/mono-rt (30832):   at Android.Runtime.JNIEnv.NewString (string) [0x0000a] in <e79c73bcbbb547688bef6c7e9665c95e>:0 04-04 11:52:07.924 E/mono-rt (30832):   at Java.Lang.Error..ctor (string) [0x00020] in <e79c73bcbbb547688bef6c7e9665c95e>:0 04-04 11:52:07.924 E/mono-rt (30832):   at Android.Runtime.JavaProxyThrowable..ctor (System.Exception) [0x00007] in <e79c73bcbbb547688bef6c7e9665c95e>:0 04-04 11:52:07.924 E/mono-rt (30832):   at Java.Lang.Throwable.FromException (System.Exception) [0x0001e] in <e79c73bcbbb547688bef6c7e9665c95e>:0 04-04 11:52:07.924 E/mono-rt (30832):   at Android.Runtime.AndroidEnvironment.UnhandledException (System.Exception) [0x00068] in <e79c73bcbbb547688bef6c7e9665c95e>:0 04-04 11:52:07.924 E/mono-rt (30832):   at (wrapper dynamic-method) object.1df32498-cacf-4686-8c6a-cd4a5d878faf (intptr,intptr) [0x00029] in <657aa8fea4454dc898a9e5f379c58734>:0 04-04 11:52:07.924 E/mono-rt (30832):   at (wrapper native-to-managed) object.1df32498-cacf-4686-8c6a-cd4a5d878faf (intptr,intptr) [0x00021] in <657aa8fea4454dc898a9e5f379c58734>:0 04-04 11:52:07.924 E/mono-rt (30832): /proc/self/maps:
android mobile xamarin.forms renderer
1个回答
0
投票

这应该通过使用旧的JNI构造函数和旧的渲染器来解决

© www.soinside.com 2019 - 2024. All rights reserved.