Xamarin `Java.Lang.NoSuchMethodError`使用导航抽屉时发生异常
我正试图使用Xamarin `Java.Lang.NoSuchMethodError`使用导航抽屉时发生异常,xamarin,xamarin.android,xamarin.forms,syncfusion,Xamarin,Xamarin.android,Xamarin.forms,Syncfusion,我正试图使用Syncfusion-SfNavigationDrawer创建一个导航抽屉,但在android模拟器上出现以下异常 Java.Lang.NoSuchMethodError:在Lcom/xamarin/forms/platform/android/FormsViewGroup类中没有名为='setClipToOutline'签名='(Z)V'的方法 这是我的代码: public class MainPage : ContentPage { public MainP
Syncfusion-SfNavigationDrawer
创建一个导航抽屉
,但在android模拟器上出现以下异常
Java.Lang.NoSuchMethodError:在Lcom/xamarin/forms/platform/android/FormsViewGroup类中没有名为='setClipToOutline'签名='(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;
}
}
public类主页:ContentPage
{
公共主页()
{
SfNavigationDrawer nav=新的SfNavigationDrawer();
StackLayout mainStack=新StackLayout();
不透明度=1;
主堆栈方向=堆栈方向垂直;
mainStack.HeightRequest=500;
mainStack.BackgroundColor=颜色.白色;
ObservableCollection列表=新的ObservableCollection();
列表。添加(“主页”);
ListView ListView=新建ListView();
listView.WidthRequest=200;
listView.VerticalOptions=LayoutOptions.FillAndExpand;
listView.ItemsSource=列表;
mainStack.Children.Add(列表视图);
nav.DrawerContentView=mainStack;
StackLayout headerLayout=新StackLayout();
headerLayout.Orientation=StackOrientation.Vertical;
图像=新图像();
image.Source=ImageSource.FromFile(“user.png”);
headerLayout.Children.Add(图像);
标签标题=新标签();
headerLayout.Children.Add(标题);
nav.DrawerHeaderView=车头布局;
Button imageButton=新建按钮();
imageButton.WidthRequest=50;
标签homeLabel=新标签();
homelab.Text=“Home”;
homeLabel.FontSize=15;
homelab.TextColor=Color.White;
homeLabel.HorizontalTextAlignment=TextAlignment.Center;
homeLabel.VerticalTextAlignment=TextAlignment.Center;
StackLayout headerFrame=新StackLayout();
头部框架方向=堆叠方向水平;
headerFrame.Children.Add(图像按钮);
headerFrame.Children.Add(homeLabel);
Label mainLabel=新标签();
mainLabel.Text=“Lorem…”;
StackLayout ContentFrame=新的StackLayout();
ContentFrame.Orientation=StackOrientation.Vertical;
ContentFrame.BackgroundColor=Color.White;
ContentFrame.Children.Add(headerFrame);
ContentFrame.Children.Add(主标签);
nav.ContentView=ContentFrame;
导航位置=位置左侧;
nav.Transition=Transition.SlideOnTop;
这个.Content=nav;
}
}
我使用的是
Xamarin.Forms 2.3.0.49
,以及Syncfusion ES 14.2.0.26
。我应该注意到,更新Xamarin
和Android构建工具
没有帮助。这是库中已知的错误。在他们的论坛上看到最新的帖子。尝试使用和的替代解决方案
从链接中总结:
希望有帮助 这是库中已知的错误。在他们的论坛上看到最新的帖子。尝试使用和的替代解决方案 从链接中总结: 希望有帮助 我也有同样的问题。 以下是Syncfusion支持团队的答案: 报告的崩溃“名称为setClipOutline的无方法”已在我们最新的Essential Studio第2卷Service Pack 2,2016(版本14.2.0.32)中修复,可通过以下链接下载 问题解决了。我也有同样的问题。 以下是Syncfusion支持团队的答案: 报告的崩溃“名称为setClipOutline的无方法”已在我们最新的Essential Studio第2卷Service Pack 2,2016(版本14.2.0.32)中修复,可通过以下链接下载 问题解决了