Xamarin'Resource.Layout'不包含'Tabbar'错误的定义 [英] Xamarin 'Resource.Layout' does not contain a definition for 'Tabbar' error

查看:280
本文介绍了Xamarin'Resource.Layout'不包含'Tabbar'错误的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个基本的xamarin.forms项目(使用PCL代码共享策略),并且MainActivity::OnCreate()

I've created a basic xamarin.forms project (with PCL code sharing strategy) and I'm getting error for the following two lines in MainActivity::OnCreate()

TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;

CS0117'Resource.Layout'不包含'Tabbar'的定义
CS0117'Resource.Layout'不包含'Toolbar'的定义

CS0117 'Resource.Layout' does not contain a definition for 'Tabbar'
CS0117 'Resource.Layout' does not contain a definition for 'Toolbar'

资源文件以Resources\layout\Tabbar.axmlResources\layout\Toolbar.axml的形式存在,并且它们的构建操作都设置为AndroidResource.

The resource files exist as Resources\layout\Tabbar.axml and Resources\layout\Toolbar.axml and the build action for both of them is set to AndroidResource.

我怀疑我的android SDK安装有问题.当前已安装以下软件包:

I suspect there is something wrong with my android SDK installation. Currently the following packages are installed:

但是Visual Studio 2015中的Run按钮仍然显示Android 6.0 API 23,并且无法更改它:

But the Run button in Visual Studio 2015 still is showing Android 6.0 API 23 and it's not possible to change it:

我还将Android项目的Target Framework版本设置为7.1:

I've also set the Target Framework version of the Android project to 7.1:

项目结构如下:

我已遵循本教程逐步创建示例项目.

I've followed this tutorial step by step to create the sample project.

如何解决错误?

推荐答案

在安装的API中似乎出现了问题.对于我来说,必须安装哪些API还是一个谜,但是删除构建工具24并安装构建工具26.0.1解决了构建问题.

The problem seems in API installed. It is still a little mystery for me which APIs must be installed but deleting the build tools 24 and installing build tools 26.0.1 fixed the issue for build.

然后安装缺少的NDK,并在Xamarin选项中设置路径. 现在有2个选项可用于支持HAXM和/或Hyper-V的计算机

Then installed NDK which was missing and set path in Xamarin options. Now 2 options are available for computers supporting HAXM and/or Hyper-V

  1. HAXM.禁用Hyper-V.然后在未创建的AVD管理器中更改模拟器设置,并使用Android SDK下载用于模拟器的Itom映像.下载并安装HAXM.你准备好了.
  2. 启用Hyper-V.下载并安装Hyper-V VS模拟器.运行它并创建模拟器虚拟机.准备好了.

运行您的应用.

这篇关于Xamarin'Resource.Layout'不包含'Tabbar'错误的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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