2017-09-25 55 views
0

在發佈模式下執行我的Xamarin Android應用程序時出現以下錯誤。我想在LinkerPleaseInclude.cs中缺少一些東西,但是錯誤信息不是很有幫助。如何閱讀Xamarin中的鏈接器錯誤

09-25 16:17:38.140 W/art  (1082): JNI RegisterNativeMethods: attempt to register 0 native methods for mvvmcross.binding.droid.views.MvxRadioGroup 
[0:] MvxBind:Error: 2,89 Exception thrown during the view binding ArgumentNullException: missing source event info in MvxWeakEventSubscription 
Parameter name: sourceEventInfo 
     at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler`1[TEventArgs] targetEventHandler) [0x00017] in <54d9eb77c4d448d4bc5e7c7a5cdd0a97>:0 
    at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.String sourceEventName, System.EventHandler`1[TEventArgs] targetEventHandler) [0x00012] in <54d9eb77c4d448d4bc5e7c7a5cdd0a97>:0 
    at MvvmCross.Platform.WeakSubscription.MvxWeakSubscriptionExtensionMethods.WeakSubscribe[TSource,TEventArgs] (TSource source, System.String eventName, System.EventHandler`1[TEventArgs] eventHandler) [0x00000] in <54d9eb77c4d448d4bc5e7c7a5cdd0a97>:0 
    at MvvmCross.Binding.Droid.Target.MvxTextViewTextTargetBinding.SubscribeToEvents() [0x0000b] in <cc9453c0f5794d529a8b1975bb62dd40>:0 
    at MvvmCross.Binding.Bindings.MvxFullBinding.CreateTargetBinding (System.Object target) [0x00057] in <5d9349f2d9c240e38eaeca40fe71d977>:0 
    at MvvmCross.Binding.Bindings.MvxFullBinding..ctor (MvvmCross.Binding.MvxBindingRequest bindingRequest) [0x0002f] in <5d9349f2d9c240e38eaeca40fe71d977>:0 
    at MvvmCross.Binding.Binders.MvxFromTextBinder.BindSingle (MvvmCross.Binding.MvxBindingRequest bindingRequest) [0x00000] in <5d9349f2d9c240e38eaeca40fe71d977>:0 
    at MvvmCross.Binding.Binders.MvxFromTextBinder+<>c__DisplayClass2_0.<Bind>b__0 (MvvmCross.Binding.Bindings.MvxBindingDescription description) [0x00018] in <5d9349f2d9c240e38eaeca40fe71d977>:0 
    at System.Linq.Utilities+<>c__DisplayClass2_0`3[TSource,TMiddle,TResult].<CombineSelectors>b__0 (TSource x) [0x00012] in <9ecdeee51aa740839577d6db9550e95f>:0 
    at System.Linq.Utilities+<>c__DisplayClass2_0`3[TSource,TMiddle,TResult].<CombineSelectors>b__0 (TSource x) [0x00000] in <9ecdeee51aa740839577d6db9550e95f>:0 
    at (wrapper delegate-invoke) System.Func`2[System.Collections.Generic.KeyValuePair`2[System.String,MvvmCross.Binding.Parse.Binding.MvxSerializableBindingDescription],System.Collections.Generic.KeyValuePair`2[System.Object,MvvmCross.Binding.Bindings.IMvxUpdateableBinding]]:invoke_TResult_T (System.Collections.Generic.KeyValuePair`2<string, MvvmCross.Binding.Parse.Binding.MvxSerializableBindingDescription>) 
    at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].MoveNext() [0x00048] in <9ecdeee51aa740839577d6db9550e95f>:0 
    at System.Collections.Generic.List`1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable`1[T] collection) [0x000ea] in <b2855d13f99e445b95990a59348d98e8>:0 
    at System.Collections.Generic.List`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] collection) [0x00000] in <b2855d13f99e445b95990a59348d98e8>:0 
    at MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.StoreBindings (Android.Views.View view, System.Collections.Generic.IEnumerable`1[T] newBindings) [0x00028] in <cc9453c0f5794d529a8b1975bb62dd40>:0 
    at MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.ApplyBindingsFromAttribute (Android.Views.View view, Android.Content.Res.TypedArray typedArray, System.Int32 attributeId) [0x0001c] in <cc9453c0f5794d529a8b1975bb62dd40>:0 

我明白,MvxRadioGroup缺少一些東西。如何找出在LinkerPleaseInclude中添加什麼?

我對MvxRadioGroup結合如下:

<MvxRadioGroup 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:layout_marginTop="6dp" 
    local:MvxBind="ItemsSource GenderAnswers; SelectedItem GenderAnswer" 
    local:MvxItemTemplate="@layout/radioitem_enum" /> 

和我LinkerPleaseInclude仍然是空的。

下面是在視圖模型的屬性的defintiion:

public IEnumerable<GenderQuestionAnswers> GenderAnswers => Enum.GetValues(typeof(GenderQuestionAnswers)).Cast<GenderQuestionAnswers>(); 

public GenderQuestionAnswers? GenderAnswer 
{ 
    get => _genderAnswer; 
    set => SetProperty(ref _genderAnswer, value); 
} 

[編輯2017年9月27日]:添加代碼MvxRadioGroup結合

[編輯2017年9月27日]:加入片斷用於視圖模型

+0

我想我們可能需要看一些代碼來幫助您找出問題,您的'LinkerPleaseInclude'類和關於您的'MvxRadioGroup'的代碼。 –

+0

我添加了我的綁定代碼。正如所說:我很確定它與LinkerPleaseInclude有關。由於在其他位置有類似的錯誤,我想知道:我是否閱讀這些錯誤,以及他們如何將我指向正確的解決方案。 –

+0

你能告訴我們你的財產GenderAnswers和GenderAnser的設置嗎? – Unlockedluca

回答

0

我結束了除了由@提到的文件中添加論文線LinkerPleaseInclude屬性紐約深-MSFT

public void Include(RadioButton radioButton) 
{ 
    radioButton.CheckedChange += (sender, args) => radioButton.Checked = args.IsChecked 
} 

那麼,這並不能真正回答我的問題,因爲我想知道如何找到正確的解決方案,而不需要搜索整個互聯網上的其他線路,並進行試驗和錯誤,但它解決了我現在的實際問題。