xamarin,visual studio 2015 组件元素未声明

xamarin, visual studio 2015 component element is not declared

我是移动编程和 c# 方面的新手,我开始在一家公司实习,公司希望我学习 xamarin 并为他们的 ERP 项目执行一个小型应用程序。无论如何我进展顺利但我必须制作一个导航抽屉菜单我检查网络中的示例并下载源代码以查看项目是如何构建的但是当我尝试 运行 我自己的应用程序和下载的项目时我得到以下错误 我下载的项目的 axml 文件

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/myDrawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
<!-- The main content view -->
    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <TextView
            android:id="@+id/tvText"
            android:text="Hey slide from left or right"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center" />
    </FrameLayout>
<!-- The left navigation drawer -->
    <ListView
        android:id="@+id/leftListView"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="left"
        android:choiceMode="singleChoice"
        android:divider="#D2D2D2"
        android:dividerHeight="2dp"
        android:background="#F2F2F2" />
<!-- The right navigation drawer -->
    <ListView
        android:id="@+id/rightListView"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="right"
        android:choiceMode="singleChoice"
        android:divider="#D2D2D2"
        android:dividerHeight="2dp"
        android:background="#F2F2F2" />
</android.support.v4.widget.DrawerLayout>

获得

The 'android.support.v4.widget.DrawerLayout' element is not declared. DrawerLayoutTutorial C:\Users\cankut\Desktop\Xamarin27Done\DrawerLayoutTutorial\DrawerLayoutTutorial\Resources\layout\Main.axml 2

另外,当我尝试 debug/run 编程时,出现以下错误

Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r28.zip and extract it to the C:\Users\cankut\AppData\Local\Xamarin\Xamarin.Android.Support.v4.2.1.0\content directory. DrawerLayoutTutorial C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.target

但我已经得到组件 android.support.v4,android 支持设计器。 我也曾尝试在 nuget 包中安装组件,但仍然没有成功,我也在网上查看我的问题,但没有成功,我的问题似乎大不相同,而且我的 android 支持存储库是最新的,感谢您的回答。

您好,这是因为 Xamarin 无法完全下载 zip

参考http://duanenewman.net/blog/post/2016/03/16/Xamarin-Build-Errors-Please-Install-Package-XamarinAndroidSupportv4.aspx

也可以尝试删除该位置的文件并重建它会为您下载或从指定的 url 手动下载并添加到 zips