C# Xamarin Android无法绑定到服务空指针
你好,我正在用Xamarin C#来做Android。 我试图用ListView构建一个小部件 我的移植代码: 首先我把这个移植到C#: (来源:) 然后我做了这个改变: 现在我卡住了。每次我尝试将小部件添加到屏幕时,它只显示RemoteView空视图,并因以下错误而崩溃:C# Xamarin Android无法绑定到服务空指针,c#,android,service,xamarin,nullpointerexception,C#,Android,Service,Xamarin,Nullpointerexception,你好,我正在用Xamarin C#来做Android。 我试图用ListView构建一个小部件 我的移植代码: 首先我把这个移植到C#: (来源:) 然后我做了这个改变: 现在我卡住了。每次我尝试将小部件添加到屏幕时,它只显示RemoteView空视图,并因以下错误而崩溃: Java.Lang.RuntimeException: Unable to bind to service md5037fca43706e0b812912372d4076c895.WidgetService@3888bf9f
Java.Lang.RuntimeException: Unable to bind to service md5037fca43706e0b812912372d4076c895.WidgetService@3888bf9f with Intent { dat=intent: cmp=StimeApplication.StimeApplication/md5037fca43706e0b812912372d4076c895.WidgetService (has extras) }: java.lang.NullPointerException: Attempt to invoke interface method 'void android.widget.RemoteViewsService$RemoteViewsFactory.onCreate()' on a null object reference ---> Java.Lang.NullPointerException: Attempt to invoke interface method 'void android.widget.RemoteViewsService$RemoteViewsFactory.onCreate()' on a null object reference
at --- End of managed exception stack trace ---
at java.lang.NullPointerException: Attempt to invoke interface method 'void android.widget.RemoteViewsService$RemoteViewsFactory.onCreate()' on a null object reference
at at android.widget.RemoteViewsService.onBind(RemoteViewsService.java:243)
at at android.app.ActivityThread.handleBindService(ActivityThread.java:2939)
at at android.app.ActivityThread.access$1900(ActivityThread.java:169)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1511)
at at android.os.Handler.dispatchMessage(Handler.java:111)
at at android.os.Looper.loop(Looper.java:194)
at at android.app.ActivityThread.main(ActivityThread.java:5552)
at at java.lang.reflect.Method.invoke(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:372)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
--- End of inner exception stack trace ---
at --- End of managed exception stack trace ---
at java.lang.RuntimeException: Unable to bind to service md5037fca43706e0b812912372d4076c895.WidgetService@3888bf9f with Intent { dat=intent: cmp=StimeApplication.StimeApplication/md5037fca43706e0b812912372d4076c895.WidgetService (has extras) }: java.lang.NullPointerException: Attempt to invoke interface method 'void android.widget.RemoteViewsService$RemoteViewsFactory.onCreate()' on a null object reference
at at android.app.ActivityThread.handleBindService(ActivityThread.java:2952)
at at android.app.ActivityThread.access$1900(ActivityThread.java:169)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1511)
at at android.os.Handler.dispatchMessage(Handler.java:111)
at at android.os.Looper.loop(Looper.java:194)
at at android.app.ActivityThread.main(ActivityThread.java:5552)
at at java.lang.reflect.Method.invoke(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:372)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
at Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void android.widget.RemoteViewsService$RemoteViewsFactory.onCreate()' on a null object reference
at at android.widget.RemoteViewsService.onBind(RemoteViewsService.java:243)
at at android.app.ActivityThread.handleBindService(ActivityThread.java:2939)
at ... 9 more
我希望有人能帮助我,我不知道搜索什么以及这个错误是从哪里来的。经过几个小时的搜索后修复了它。答复: “您必须从Java.Lang.Object继承并删除句柄和Dispose方法。” 从…起
我还更新了我的git respority,所以可以随意使用它。经过几个小时的搜索后修复了它。答复: “您必须从Java.Lang.Object继承并删除句柄和Dispose方法。” 从…起 我还更新了我的git respority,所以可以随意使用它