尝试在Visual Studio 2015中将设计视图用于Xamarin表单的问题 [英] Issues trying to use the Design view for a Xamarin Form in Visual Studio 2015

查看:181
本文介绍了尝试在Visual Studio 2015中将设计视图用于Xamarin表单的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首次使用Xamarin的用户.我正在尝试为我的高级项目创建一个跨平台的电话应用程序,但在Visual Studio 2015中设置Xamarin时一直遇到问题.特别是,无论使用什么工具,我都无法使用设计视图 我尝试创建的应用程序类型!

First time Xamarin user. I'm trying to create a cross-platform phone app for my senior project, but I keep running into issues with setting up Xamarin in Visual Studio 2015. Specifically, I cannot use the Design view for the projects, regardless of what type of app I try to create!

当尝试创建空白应用程序(本机可移植)时,尝试在设计视图中打开Main.axml文件将返回错误:

When trying to create a Blank App (Native Portable), attempting to open up the Main.axml file in the Design View would return the error:

出了什么问题
安装的Android SDK过旧.需要版本25.1.3或更高版本.请更新到最新版本.
操作: 打开Android SDK

Something went wrong
The installed Android SDK is too old. Version 25.1.3 or newer is required. Please update to the latest version.
Actions:Open Android SDK

但是,我已经安装了25.2.2版,并且"Open Android SDK"超链接什么都不做.尝试运行SDK Manager.exe只需打开命令提示符并立即关闭它.我被告知打开我的android.bat文件 在诸如记事本++之类的文本编辑器中,并修改"set java_exe ="实例.和"set javaw_exe ="指向我的java.exe安装,但这没有任何改变;运行android.bat只需验证我是否有Android SDK 已安装工具版本25.2.2,并且没有平台工具或构建工具的更新.

However, I have version 25.2.2 installed, and the "Open Android SDK" hyperlink does nothing. Attempting to run SDK Manager.exe simply opens a command prompt for a split second and immediately closes it. I was informed to open my android.bat file in a text editor like Notepad++ and modify instances of "set java_exe=" and "set javaw_exe=" to point towards my java.exe installation, but that didn't change anything; running android.bat simply verifies that I have Android SDK Tools revision 25.2.2 installed, and that there are no updates for Platform-tools or Build-tools.

所以我决定重新开始,然后转到Xamarin.Form.但是,启动新的Xamarin.Form会显示以下弹出窗口:

So I decided to start over and move on to a Xamarin.Form instead. However, starting a new Xamarin.Form presents the following pop-up:

在创建子项目'[projectname] .Windows'时遇到问题.导入的项目"C:\ Program Files(x86)\ MSBuild \ Microsoft \ WindowsXaml \ v14.0 \ 8.1 \ Microsoft.Windows.UI.Xaml.CSharp.targets"没有找到.确认路径在 <导入>声明正确,并且文件在磁盘上.
C:\ Program Files(x86)\ MSBuild \ Microsoft \ WindowsXaml \ v14.0 \ 8.1 \ Microsoft.Windows.UI.Xaml.CSharp.targets

A problem was encountered creating the sub project '[projectname].Windows'. The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\8.1\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on the disk.
C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\8.1\Microsoft.Windows.UI.Xaml.CSharp.targets

此外,[项目名称] .iOS文件夹没有Main.axml文件.[项目名称] .iOS文件夹没有Droid或Main.storyboard-因此,我无法创建UI,更不用说访问设计视图了.

Further, there is no Main.axml file for the [projectname].Droid or Main.storyboard for the [projectname].iOS folder - so I can't create a UI, much less access a Design View.

请帮助我至少开始其中之一!

Please help me to begin work on at least one of these!

P.S.在所有情况下共享的一个问题是,我的家中没有Mac计算机供Xamarin Mac Agent检测.

P.S. A problem shared in all instances is that my home has no Mac computers for the Xamarin Mac Agent to detect. Will I be able to develop for iOS devices without this?

推荐答案

约翰,

欢迎来到MSDN论坛.

参考您的描述,我试图在像您这样的新Xamarin项目中打开Main.axml文件,效果很好,看来此问题与您的VS更相关本身.

>>安装的Android SDK过旧.需要版本25.1.3或更高版本.请更新到最新版本.

有关错误消息,请查看

For the error message, please have a look at this similar issue and I found some workarounds as below, you can have a try to troubleshot this issue:

  1. 转到工具">选项> Xamarin> Android设置,以验证指向JDK,Android SDK和Android NDK的正确位置.
  2. 将Xamarin升级到最新版本版本:工具-选项-Xamarin-其他,然后单击立即检查",如果有任何稳定版本,请安装它.
  3. 检查已安装的Android SDK版本:Tools-Android-Android SDK Manager,它看起来像最新版本的Android 25.2.2.
  4. 安装JDK 1.8: Xamarin.Android 7.0需要 JDK 1.8 以使用Android Nougat(API 24)API.
  5. 从API 14(android 4.0)安装所有Android SDK到最新版本:Tools-Android-Android SDK Manager并安装这些Android SDK版本.
  1. Go to Tools > Options > Xamarin > Android Settings to verify that the correct locations are pointed to for the JDK, Android SDK, and Android NDK.
  2. Upgrade the Xamarin to the latest version: Tools—Options-Xamarin-Other and click the "Check Now", if there is any stable version, please install it.
  3. Check the installed Android SDK versions: Tools-Android-Android SDK Manager and it looks like the latest version of Android 25.2.2.
  4. Install JDK 1.8: Xamarin.Android 7.0 requires JDK 1.8 to use the Android Nougat (API 24) APIs.
  5. Install all Android SDK from API 14(android 4.0) to the latest versions: Tools-Android-Android SDK Manager and install those Android SDK versions.

>>创建子项目'[projectname] .Windows'时遇到问题.导入的项目"C:\ Program Files(x86)\ MSBuild \ Microsoft \ WindowsXaml \ v14.0 \ 8.1 \ Microsoft.Windows.UI.Xaml.CSharp.targets" 没有找到.确认< Import>中的路径是否正确.声明正确,并且文件在磁盘上.
C:\ Program Files(x86)\ MSBuild \ Microsoft \ WindowsXaml \ v14.0 \ 8.1 \ Microsoft.Windows.UI.Xaml.CSharp.targets

>> A problem was encountered creating the sub project '[projectname].Windows'. The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\8.1\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on the disk.
C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\8.1\Microsoft.Windows.UI.Xaml.CSharp.targets

请参阅 Jarek Kardas 看起来很合理.

Please see this similar issue and the solutions from Damien_The_Unbeliever and Jarek Kardas looks reasonable.

Jarek Kardas:尝试将8.0和8.1目录从C:\ Program Files(x86)\ MSBuild \ Microsoft \ WindowsXaml \ v12.0复制到C:\ Program Files( x86)\ MSBuild \ Microsoft \ WindowsXaml \ v14.0(末尾的通知版本号).

最好的问候,

萨拉


这篇关于尝试在Visual Studio 2015中将设计视图用于Xamarin表单的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆