使用导航抽屉时出现`Java.Lang.NoSuchMethodError`异常

时间:2016-08-22 09:29:28

标签: xamarin xamarin.android xamarin.forms syncfusion

我正在尝试使用navigation drawer创建Syncfusion SfNavigationDrawer,但我在Android模拟器上遇到以下异常。

  

Java.Lang.NoSuchMethodError:类Lcom / xamarin / forms / platform / android / FormsViewGroup中没有name ='setClipToOutline'cignra ='(Z)V'的方法;

这是我的代码:

public class MainPage : ContentPage
{       
    public MainPage()
    {
        SfNavigationDrawer nav = new SfNavigationDrawer();

        StackLayout mainStack = new StackLayout();
        mainStack.Opacity = 1;
        mainStack.Orientation = StackOrientation.Vertical;
        mainStack.HeightRequest = 500;
        mainStack.BackgroundColor = Color.White;

        ObservableCollection<String> list = new ObservableCollection<string>();
        list.Add("Home");


        ListView listView = new ListView();
        listView.WidthRequest = 200;
        listView.VerticalOptions = LayoutOptions.FillAndExpand;
        listView.ItemsSource = list;
        mainStack.Children.Add(listView);

        nav.DrawerContentView = mainStack;


        StackLayout headerLayout = new StackLayout();
        headerLayout.Orientation = StackOrientation.Vertical;

        Image image = new Image();
        image.Source = ImageSource.FromFile("user.png");
        headerLayout.Children.Add(image);

        Label header = new Label();
        headerLayout.Children.Add(header);
        nav.DrawerHeaderView = headerLayout;



        Button imageButton = new Button();
        imageButton.WidthRequest = 50;

        Label homeLabel = new Label();
        homeLabel.Text = "Home";
        homeLabel.FontSize = 15;
        homeLabel.TextColor = Color.White;
        homeLabel.HorizontalTextAlignment = TextAlignment.Center;
        homeLabel.VerticalTextAlignment = TextAlignment.Center;

        StackLayout headerFrame = new StackLayout();
        headerFrame.Orientation = StackOrientation.Horizontal;
        headerFrame.Children.Add(imageButton);
        headerFrame.Children.Add(homeLabel);

        Label mainLabel = new Label();
        mainLabel.Text = "Lorem...";

        StackLayout ContentFrame = new StackLayout();
        ContentFrame.Orientation = StackOrientation.Vertical;
        ContentFrame.BackgroundColor = Color.White;
        ContentFrame.Children.Add(headerFrame);
        ContentFrame.Children.Add(mainLabel);
        nav.ContentView = ContentFrame;

        nav.Position = Position.Left;
        nav.Transition = Transition.SlideOnTop;

        this.Content = nav;

    }
}

我正在使用Xamarin.Forms 2.3.0.49Syncfusion ES 14.2.0.26。我应该注意更新XamarinAndroid build-tools没有帮助。

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:1)

我遇到了同样的问题。 以下是Syncfusion支持团队的答案: 我们最新的Essential Studio Volume 2 Service Pack 2,2016(版本14.2.0.32)中已修复报告的崩溃“没有名称为setClipOutline的方法”,可通过以下链接下载。

https://www.syncfusion.com/forums/125638/essential-studio-2016-volume-2-service-pack-release-v14-2-0-32-available-for-download

问题解决了。