kil*_*ler 0 c# service android nullpointerexception xamarin
您好我正在使用Xamarin C#for Android.我试图用ListView构建一个Widget.
我移植的代码:https://github.com/Nailik/AppWidgetListView
首先我把它移植到C#:https: //laaptu.wordpress.com/2013/07/19/android-app-widget-with-listview/ (来源:https://github.com/laaptu/appwidget-listview/ tree/appwidget-listview1)
然后我做了这个改变:https://forums.xamarin.com/discussion/16930/app-widget-with-listview
现在我卡住了.每当我尝试将Widget添加到我的屏幕时,它只显示远程视图空视图并且因此错误而崩溃:
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
Run Code Online (Sandbox Code Playgroud)
我希望有人可以帮助我,我不知道该搜索什么以及这个错误来自哪里.
经过几个小时的搜索后修复了它.答:"你必须继承Java.Lang.Object并删除Handle和Dispose方法." 从https://forums.xamarin.com/discussion/8506/crash-from-native-handle 我也updatet我的混帐respority可以随意使用.
| 归档时间: |
|
| 查看次数: |
383 次 |
| 最近记录: |