【问题标题】:xamarin, visual studio 2015 component element is not declaredxamarin,Visual Studio 2015 组件元素未声明
【发布时间】:2016-10-29 05:34:15
【问题描述】:

我是移动编程和 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>

得到

'android.support.v4.widget.DrawerLayout' 元素不是 宣布。 DrawerLayoutTutorial C:\Users\cankut\Desktop\Xamarin27Done\DrawerLayoutTutorial\DrawerLayoutTutorial\Resources\layout\Main.axml 2

当我尝试调试/运行程序时,我得到以下错误

解压失败。请下载 https://dl-ssl.google.com/android/repository/android_m2repository_r28.zip 并将其提取到 C:\Users\cankut\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.2.1.0\content 目录。 DrawerLayoutTutorial C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.target

但我有组件 android.support.v4,android 支持设计器。 我也曾尝试在 nuget 包中安装组件,但仍然没有运气,我还检查了网络是否有我的问题,但没有运气似乎我的问题大不相同,我的 android 支持存储库也是最新的,谢谢你的回答。

【问题讨论】:

  • 你能解决这个问题吗?

标签: c# android visual-studio xamarin components


【解决方案1】:

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

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

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

【讨论】:

  • 帖子的链接已损坏。您可能需要提供详细信息以明确答案。
猜你喜欢
  • 1970-01-01
  • 2016-07-22
  • 2018-05-03
  • 1970-01-01
  • 1970-01-01
  • 2017-11-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多