Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin 'Resource.Layout' does not contain a definition for 'Tabbar' error

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' does not contain a definition for 'Tabbar'
CS0117 'Resource.Layout' does not contain a definition for 'Toolbar'

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.

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

enter image description here

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

enter image description here

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

enter image description here

The project structure is as the following:

enter image description here

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

How can I get the error fixed?

like image 251
B Faley Avatar asked Jul 29 '17 20:07

B Faley


1 Answers

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.

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. Disable Hyper-V. Then change emulator setting in AVD manager which were not created and download an Itom image for emulator using Android SDK. Download and install HAXM. You are ready.
  2. Enable Hyper-V. Download and install Hyper-V VS emulators. Run it and create emulator(s) virtual machine(s). You are ready.

Run your app.

like image 105
Yuri S Avatar answered Nov 14 '22 20:11

Yuri S