一周前我发现了Xamarin框架,我的工作是让Android应用程序正常运行。iOS应用程序已经在之前发布。
我首先需要处理一些NuGet软件包的依赖关系,但现在我遇到的唯一异常是:
06-26 15:01:40.719 E/mono-rt (20038): [ERROR] FATAL UNHANDLED EXCEPTION: Android.Content.Res.Resources+NotFoundException: Resource ID #0x0
06-26 15:01:40.719 E/mono-rt (20038): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
06-26 15:01:40.719 E/mono-rt (20038): at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (JniObjectReference instance, JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x000a7] in /Users/builder/data/lanes/3340/4e275588/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:12083
06-26 15:01:40.719 E/mono-rt (20038): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00000] in /Users/builder/data/lanes/3340/4e275588/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:444
06-26 15:01:40.719 E/mono-rt (20038): at Android.Runtime.JNIEnv.FinishCreateInstance (IntPtr instance, IntPtr jclass, IntPtr constructorId, Android.Runtime.JValue* constructorParameters) [0x0000b] in /Users/builder/data/lanes/3340/4e275588/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:339
06-26 15:01:40.719 E/mono-rt (20038): at Android.Support.V4.App.ActionBarDrawerToggle..ctor (Android.App.Activity activity, Android.Support.V4.Widget.DrawerLayout drawerLayout, Int32 drawerImageRes, Int32 openDrawerContentDescRes, Int32 closeDrawerContentDescRes) [0x00124] in <filename unknown>:0
06-26 15:01:40.719 E/mono-rt (20038): at Xamarin.Forms.Platform.Android.Platform.GetNewMasterDetailToggle () [0x00030] in <filename unknown>:0
06-26 15:01:40.719 E/mono-rt (20038): at Xamarin.Forms.Platform.Android.Platform.UpdateMasterDetailToggle (Boolean update) [0x00075] in <filename unknown>:0
06-26 15:01:40.719 E/mono-rt (20038): at Xamarin.Forms.Platform.Android.Platform.UpdateActionBar () [0x000a6] in <filename unknown>:0
06-26 15:01:40.719 E/mono-rt (20038): at Xamarin.Forms.Platform.Android.Platform.SetPage (Xamarin.Forms.Page newRoot) [0x000bd] in <filename unknown>:0
06-26 15:01:40.719 E/mono-rt (20038): at Xamarin.Forms.Platform.Android.FormsApplicationActivity.InternalSetPage (Xamarin.Forms.Page page) [0x000b7] in <filename unknown>:0
06-26 15:01:40.719 E/mono-rt (20038): at Xamarin.Forms.Platform.Android.FormsApplicationActivity.SetMainPage () [0x0000c] in <filename unknown>:0
06-26 15:01:40.719 E/mono-rt (20038): at Xamarin.Forms.Platform.Android.FormsApplicationActivity.LoadApplication (Xamarin.Forms.Application application) [0x0002d] in <filename unknown>:0
06-26 15:01:40.719 E/mono-rt (20038): at savtime.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0001e] in D:\sources\savtime-mobile\Droid\MainActivity.cs:27
06-26 15:01:40.719 E/mono-rt (20038): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/3340/4e275588/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:2426
06-26 15:01:40.719 E/mono-rt (20038): at (wrapper dynamic-method) System.Object:72e9ca78-aec6-45d3-82e8-45b117f59475 (intptr,intptr,intptr)
06-26 15:01:40.719 E/mono-rt (20038): --- End of managed exception stack trace ---
06-26 15:01:40.719 E/mono-rt (20038): android.content.res.Resources$NotFoundException: Resource ID #0x0
06-26 15:01:40.719 E/mono-rt (20038): at android.content.res.Resources.getValue(Resources.java:1243)
06-26 15:01:40.719 E/mono-rt (20038): at android.content.res.Resources.getDrawable(Resources.java:766)
06-26 15:01:40.719 E/mono-rt (20038): at android.content.Context.getDrawable(Context.java:402)
06-26 15:01:40.719 E/mono-rt (20038): at android.support.v4.content.ContextCompatApi21.getDrawable(ContextCompatApi21.java:26)
06-26 15:01:40.719 E/mono-rt (20038): at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:321)
06-26 15:01:40.719 E/mono-rt (20038): at android.support.v4.app.ActionBarDrawerToggle.<init>(ActionBarDrawerToggle.java:277)
06-26 15:01:40.719 E/mono-rt (20038): at android.support.v4.app.ActionBarDrawerToggle.<init>(ActionBarDrawerToggle.java:229)
06-26 15:01:40.719 E/mono-rt (20038): at md5daa929973e91d615883be6545c9acbac.MainActivity.n_onCreate(Native Method)
06-26 15:01:40.719 E/mono-rt (20038): at md5daa929973e91d615883be6545c9acbac.MainActivity.onCreate(MainActivity.java:29)
06-26 15:01:40.719 E/mono-rt (20038): at android.app.Activity.performCreate(Activity.java:5975)
06-26 15:01:40.719 E/mono-rt (20038): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
06-26 15:01:40.719 E/mono-rt (20038): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
06-26 15:01:40.719 E/mono-rt (20038): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
06-26 15:01:40.719 E/mono-rt (20038): at android.app.ActivityThread.access$800(ActivityThread.java:147)
06-26 15:01:40.719 E/mono-rt (20038): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
06-26 15:01:40.719 E/mono-rt (20038): at android.os
我在这里看到很多帖子,问题似乎是图标的问题,但我已经检查了项目中所有资源定义,资源名称,一切看起来都没问题。
这个问题可能是由于引用有问题(比如Xamarin Forms或Iconize)吗?或者只是因为缺少资源?
我已经清理了我的解决方案,更新或降级了我的软件包,但什么都没有用。
我还必须指出,我使用F#而不是C#来开发。 我的视图是用XAML制作的。