Xamarin.Forms预览器不起作用

时间:2017-04-28 10:26:40

标签: c# xamarin mono xamarin.forms visual-studio-2017

我安装Visual Studio 2017 版本15.1(26403.7)发布。 还安装了Xamarin工作负载,当我创建新的Xamarin Cross Platform应用程序并打开渲染视图的Xamarin.Forms预览器时,获取此错误:

  

mono.android.DesignerException:md5e940e1e778de0f856e343395a2f338c5.XFPageRendererView.n_onMeasure(II)V       at mono.android.DesignerException.fromThrowable(DesignerException.java:43)       at mono.android.DesignerSession.checkRenderResultForError(DesignerSession.java:177)       在mono.android.DesignerSession.load(DesignerSession.java:228)       在mono.android.DesignerSession.processMessage(DesignerSession.java:693)       at mono.android.MessageListener.executeMessage(MessageListener.java:88)       at mono.android.MessageListener $ Runner.run(MessageListener.java:44)       在java.lang.Thread.run(Thread.java:745)   引起:java.lang.UnsatisfiedLinkError:md5e940e1e778de0f856e343395a2f338c5.XFPageRendererView.n_onMeasure(II)V       at md5e940e1e778de0f856e343395a2f338c5.XFPageRendererView.n_onMeasure(Native Method)       at md5e940e1e778de0f856e343395a2f338c5.XFPageRendererView.onMeasure(XFPageRendererView.java:54)       在android.view.View.measure(View.java:19731)       在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120)       在android.widget.FrameLayout.onMeasure(FrameLayout.java:185)       在android.view.View.measure(View.java:19731)       在android.widget.RelativeLayout.measureChildHorizo​​ntal(RelativeLayout.java:715)       在android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)       在android.view.View.measure(View.java:19731)       在com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:545)       在com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:342)       在com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)       在com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)       在mono.android.DesignerSession.load(DesignerSession.java:222)       ......还有4个

JDK版本:1.8.0_121

enter image description here

4 个答案:

答案 0 :(得分:1)

出现同样的问题,将最低Android目标更新为19,重建并重新启动VS以解决问题。

答案 1 :(得分:1)

右键单击您的应用程序项目xamarin.android。转到属性并选择使用最新平台。 enter image description here

答案 2 :(得分:0)

大多数情况下,由于Java Development Kit版本需要1.8 AND ,请确保其为64位版本。然后在选项中更新VS中的JDK位置,对我来说当前位置是:

C:\Program Files\Java\jdk1.8.0_121

答案 3 :(得分:0)

要解决此问题,我需要更新Android SDK API 24,more information