Xamarin Android使用处理程序随机崩溃无法从本机句柄激活Java.Lang.Thread + RunnableImplementor类型的实例

时间:2019-04-29 12:42:46

标签: c# android xamarin

我正在使用Xamarin Android Native通过postdelay创建一个工作处理程序,以运行从Web服务获取的一些后台数据,该处理程序每​​隔几秒钟就会调用一个函数,但是当活动运行时,应用程序随机崩溃,并且发生致命故障堆栈跟踪未指定问题的确切出处,并且每次都抛出相同的消息:“ android.runtime.JavaProxyThrowable:System.NotSupportedException:无法从本机句柄激活类型为Java.Lang.Thread + RunnableImplementor的实例”

以下是详细信息堆栈跟踪:

AndroidRuntime: FATAL EXCEPTION: main
    Process: ..., PID: 23551
    android.runtime.JavaProxyThrowable: System.NotSupportedException: Unable to activate instance of type Java.Lang.Thread+RunnableImplementor from native handle 0xffd76a6c (key_handle 0x5005665). ---> System.MissingMethodException: No constructor found for Java.Lang.Thread+RunnableImplementor::.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 <263adecfa58f4c449f1ff56156d886fd>:0 
      at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00111] in <263adecfa58f4c449f1ff56156d886fd>:0 
       --- End of inner exception stack trace ---
      at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in <263adecfa58f4c449f1ff56156d886fd>:0 
      at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in <263adecfa58f4c449f1ff56156d886fd>:0 
      at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <263adecfa58f4c449f1ff56156d886fd>:0 
      at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <263adecfa58f4c449f1ff56156d886fd>:0 
      at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in <263adecfa58f4c449f1ff56156d886fd>:0 
      at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in <263adecfa58f4c449f1ff56156d886fd>:0 
        at (wrapper dynamic-method) System.Object.eac9d564-b7f8-4035-a2ff-b38fdb337e7b(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:794)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:176)
        at android.app.ActivityThread.main(ActivityThread.java:6651)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)

谁曾经遇到过同样的事情? 以及如何解决这个问题?

非常感谢您的帮助。

0 个答案:

没有答案