Xamarin Android FATAL UNHANDLED EXCEPTION:System.NullReferenceException

我得到了一些我不理解的无法解决的异常 . 这是一个Xamarin Forms App with PCL . 第一次在调试模式下我得到错误(见下文),但当我停止调试并在调试模式下再次运行应用程序时,它运行完全正常 .

这总是重复,所以它第三次抛出错误,然后再次运行 .

01-19 15:43:44.073 D / Mono(11226):搜索'java_interop_jnienv_call_nonvirtual_boolean_method_a' . 01-19 15:43:44.073 D / Mono(11226):搜索'java_interop_jnienv_call_nonvirtual_boolean_method_a' . 01-19 15:43:44.073 D / Mono(11226):探测'java_interop_jnienv_call_nonvirtual_boolean_method_a' . 01-19 15:43:44.073 D / Mono(11226):找到'java_interop_jnienv_call_nonvirtual_boolean_method_a' . 01-19 15:43:44.083 D / Mono(11226):Assembly Ref addref Xamarin.Forms.Platform.Android [0x5bc61830] - > Xamarin.Android.Support.Design [0x5b7bd630]:2 01-19 15:43:44.093 D / Mono(11226):Assembly Ref addref Xamarin.Forms.Platform.Android [0x5bc61830] - > Xamarin.Android.Support.v7.CardView [0x5ba85088]:2 01-19 15:43:44.103 D / Mono(11226) :Assembly Ref addref Xamarin.Forms.Platform [0x5bc86768] - > Xamarin.Forms.Core [0x5bb61870]:6 01-19 15:43:44.183 I / dalvikvm(11226):找不到方法android.view.ViewGroup . ,从方法md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer引用 . 01-19 15:43:44.183 W / dalvikvm(11226):VFY:无法解析直接方法20617:Landroid / view / ViewGroup; . (Landroid / content / Context; Landroid / util / AttributeSet; II)V 01-19 15:43:44.183 D / dalvikvm(11226):VFY:将代码0x70替换为0x0000 01-19 15:43:44.223 I / Choreographer( 11226):跳过152帧!应用程序可能在其主线程上做了太多工作 . 01-19 15:43:44.233 D / Mono(11226):DllImport搜索:'__内部'('(null)') . 01-19 15:43:44.233 D / Mono(11226):搜索'java_interop_jnienv_call_static_int_method_a' . 01-19 15:43:44.233 D / Mono(11226):探测'java_interop_jnienv_call_static_int_method_a' . 01-19 15:43:44.233 D / Mono(11226):找到'java_interop_jnienv_call_static_int_method_a' . 01-19 15:43:44.273 E / HAL(11226):hw_get_module_by_class path = /system/lib/hw/gralloc.msm8960.so发生未处理的异常 . 01-19 15:43:46.396 D / Mono(11226):DllImport试图加载:'/ system / lib / liblog.so' . 01-19 15:43:46.396 D / Mono(11226):DllImport加载库'/system/lib/liblog.so' . 01-19 15:43:46.396 D / Mono(11226):DllImport搜索:'/ system / lib / liblog.so'('/ system / lib / liblog.so') . 01-19 15:43:46.396 D / Mono(11226):搜索'__android_log_print' . 01-19 15:43:46.396 D / Mono(11226):探测'__android_log_print' . 01-19 15:43:46.396 D / Mono(11226):找到'android_log_print' . 01-19 15:43:46.406 I / MonoDroid(11226):UNHANDLED EXCEPTION:01-19 15:43:46.436 I / MonoDroid(11226):System.NullReferenceException:对象引用未设置为对象的实例 . 01-19 15:43:46.436 I / MonoDroid(11226):在Xamarin.Forms.Platform.Android.AppCompat.Platform.LayoutRootPage(Xamarin.Forms.Page页面,System.Int32宽度,System.Int32高度)[0x0005d]在C:\ BuildAgent3 \ work \ ca3766cfc22354a1 \ Xamarin.Forms.Platform.Android \ AppCompat \ Platform.cs:279 01-19 15:43:46.436 I / MonoDroid(11226):at Xamarin.Forms.Platform.Android.AppCompat .Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout(System.Boolean已更改,System.Int32 l,System.Int32 t,System.Int32 r,System.Int32 b)[0x00003]在C:\ BuildAgent3 \ work中\ ca3766cfc22354a1 \ Xamarin.Forms.Platform.Android \ AppCompat \ Platform.cs:196 01-19 15:43:46.436 I / MonoDroid(11226):at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout(System.Boolean已更改) ,System.Int32 l,System.Int32 t,System.Int32 r,System.Int32 b)[0x0000e]在C:\ BuildAgent3 \ work \ ca3766cfc22354a1 \ Xamarin.Forms.Platform.Android \ PlatformRenderer.cs:73 01-19 15:43:46.436 I / MonoDroid(11226):在Android.Views.ViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv,System.IntPtr native__this,System.Boolean已更改,System.Int32 l,System.Int32 t,System.Int32 r,System.Int32 b)[0x00009]在/ Users / builder / data / lanes / 4009中//95封装动态方法)System.Object:87bb057b-ab01-43e3-9911-e54de2defaf6(intptr,intptr,bool,int,int,int,int)01-19 15:43:46.466 D / Mono(11226):DllImport搜索:' Internal'('(null)') . 01-19 15:43:46.466D / Mono(11226):搜索'java_interop_jnienv_throw' . 01-19 15:43:46.466 D / Mono(11226):探测'java_interop_jnienv_throw' . 01-19 15:43:46.466 D / Mono(11226):找到'java_interop_jnienv_throw' . 发生了未处理的异常 . 01-19 15:43:47.227 E / mono(11226):01-19 15:43:47.227 E / mono(11226):Unhandled Exception:01-19 15:43:47.227 E / mono(11226):System . NullReferenceException:未将对象引用设置为对象的实例 . 01-19 15:43:47.227 E / mono-rt(11226):[错误]致命未处理异常:System.NullReferenceException:对象引用未设置为对象的实例 . 在mgmain JNI_OnLoad中

回答(0)