MVVM Cross java.lang.ClassNotFoundException:Mvx.MvxListView

时间:2015-08-27 22:36:18

标签: android xamarin xamarin.android mvvmcross

我尝试使用MvxListView和绑定添加片段。我正在使用v4.0.0.0 beta2。

这是布局:

<?xml version="1.0" encoding="utf-8"?>
<Mvx.MvxListView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    local:MvxItemTemplate="@layout/accountlistitem"
    local:MvxBind="ItemsSource AllAccounts;ItemClick OpenOverviewCommand" />

片段:

public class AccountListFragment : MvxFragment
{
    public new AccountListViewModel ViewModel
    {
        get { return (AccountListViewModel)base.ViewModel; }
        set { base.ViewModel = value; }
    }

    public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        var ignore = base.OnCreateView(inflater, container, savedInstanceState);
        return this.BindingInflate(Resource.Layout.AccountListLayout, null);
    }
}

以及我如何在主要活动中加载片段:

var fragmenTransaction = SupportFragmentManager.BeginTransaction();
fragmenTransaction.Add(Resource.Id.content_pane, accountListFragment);
fragmenTransaction.Commit();

这里出现错误信息:

  

08-28 00:28:40.783 I / MonoDroid(4281):抑制:   java.lang.ClassNotFoundException:Mvx.MvxListView 08-28 00:28:40.783   I / MonoDroid(4281):at java.lang.Class.classForName(Native Method)   08-28 00:28:40.783 I / MonoDroid(4281):at   java.lang.BootClassLoader.findClass(ClassLoader.java:781)08-28   00:28:40.783 I / MonoDroid(4281):at   java.lang.BootClassLoader.loadClass(ClassLoader.java:841)08-28   00:28:40.783 I / MonoDroid(4281):at   java.lang.ClassLoader.loadClass(ClassLoader.java:504)08-28   00:28:40.783 I / MonoDroid(4281):... 29更多08-28 00:28:40.783   I / MonoDroid(4281):引起:java.lang.NoClassDefFoundError:Class   找不到使用引导类加载器;没有可用的堆栈

可以找到GitHub存储库here

我想念什么?我用另一个有MvxListView工作的项目检查了它,但是找不到任何差别......

1 个答案:

答案 0 :(得分:2)

尝试使用控件全名:

<?xml version="1.0" encoding="utf-8"?>
      <cirrious.mvvmcross.binding.droid.views.MvxListView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:local="http://schemas.android.com/apk/res-auto"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        local:MvxItemTemplate="@layout/accountlistitem"
        local:MvxBind="ItemsSource AllAccounts;ItemClick OpenOverviewCommand" />