需要帮助阅读Android Stacktrace以获取Mvvmcross碎片崩溃

时间:2016-01-25 10:57:54

标签: android xamarin mvvmcross

在Google Play信息中心,我发现了大量崩溃和ANR。他们有以下堆栈跟踪:

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Caused by: java.lang.reflect.InvocationTargetException
    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:1388)
    ... 1 more
Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr) <0x000db>
at Android.App.Activity.OnStart () <0x00103>
at Cirrious.MvvmCross.Droid.Fragging.MvxEventSourceFragmentActivity.OnStart () <0x00013>
at Android.App.Activity.n_OnStart (intptr,intptr) <0x00037>
at (wrapper dynamic-method) object.ecfa86e9-900d-479e-9875-6960304e8202 (intptr,intptr) <0x0003b>
    at md526035c37b8d1573464bb4caa888f0f5d.MvxEventSourceFragmentActivity.n_onStart(Native Method)
    at md526035c37b8d1573464bb4caa888f0f5d.MvxEventSourceFragmentActivity.onStart(MvxEventSourceFragmentActivity.java:78)
    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1234)
    at android.app.Activity.performStart(Activity.java:6329)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
    at android.app.ActivityThread.access$900(ActivityThread.java:177)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:5951)

我熟悉堆栈跟踪,但是通过这个特定的跟踪,我无法找出在哪里寻找。

这些错误发生在各种设备上,4. *和5. *。我也尝试重现这个错误,但没有成功。

也许这是一个我可以忽略的特定Android事物?

Xamarin:4.0.0.1717 Xamarin.Android:6.0.0.35

修改1

我找到了bugzilla item。它显示了一些相同的问题。此项目涉及Xamarin表格。我没有使用Xamarin Forms,但我已采取措施重现该错误:

  1. 启动应用
  2. 将应用程序带到后台
  3. 停止进程(使用Android设备管理器)
  4. 启动应用
  5. 然后我也得到了这个错误:

    FATAL EXCEPTION: main
    Process: com.android.MyApp, PID: 4228
    java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
    Caused by: java.lang.reflect.InvocationTargetException
        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:903)
        ... 1 more
    Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
      at MyApp.Android.Views.Framents.MessageListFragment.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x003a2] in <filename unknown>:0 
      at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_inflater, IntPtr native_container, IntPtr native_savedInstanceState) [0x00022] in <filename unknown>:0 
      at (wrapper dynamic-method) System.Object:85227a30-9274-46c5-a910-dd5907ec83c7 (intptr,intptr,intptr,intptr,intptr)
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <filename unknown>:0 
      at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod) [0x00089] in <filename unknown>:0 
      at Android.App.Activity.OnStart () [0x00079] in <filename unknown>:0 
      at Cirrious.MvvmCross.Droid.Fragging.MvxEventSourceFragmentActivity.OnStart () [0x00000] in <filename unknown>:0 
      at Android.App.Activity.n_OnStart (IntPtr jnienv, IntPtr native__this) [0x00009] in <filename unknown>:0 
      at (wrapper dynamic-method) System.Object:5c6d4542-2710-4e67-976d-a6e9d1ccd51c (intptr,intptr)
        at md526035c37b8d1573464bb4caa888f0f5d.MvxEventSourceFragmentActivity.n_onStart(Native Method)
        at md526035c37b8d1573464bb4caa888f0f5d.MvxEventSourceFragmentActivity.onStart(MvxEventSourceFragmentActivity.java:78)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236)
        at android.app.Activity.performStart(Activity.java:6006)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2288)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
        at android.app.ActivityThread.access$800(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5254)
        ... 4 more
    

1 个答案:

答案 0 :(得分:1)

我之前见过这种情况。我建议使用MvxCachingFragmentCompatActivity让它处理活动生命周期情况。你可以在这里找到一个样本:https://github.com/MvvmCross/MvvmCross-AndroidSupport/tree/master/Samples