【问题标题】:Drawable resource files not found for Google Play component未找到 Google Play 组件的可绘制资源文件
【发布时间】:2017-11-16 01:37:43
【问题描述】:

我之前一直在使用 Xamarin Studio 编写 Google 地图应用程序,并将文件复制到一个新文件夹中以便在 Visual Studio 中使用。

在 Visual Studio 中构建 Android 应用程序时,我遇到了许多与 Google Play 组件相关的资源错误。

这是错误之一:

No resource found that matches the given name (at 'drawable' with value '@drawable/common_signin_btn_icon_pressed_dark')

这是 XML 文件:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_pressed="true"
        android:drawable="@drawable/common_signin_btn_icon_pressed_dark" />
    <item
        android:state_enabled="false"
        android:state_focused="true"
        android:drawable="@drawable/common_signin_btn_icon_disabled_focus_dark" />
    <item
        android:state_focused="true"
        android:drawable="@drawable/common_signin_btn_icon_focus_dark" />
    <item
        android:state_enabled="false"
        android:drawable="@drawable/common_signin_btn_icon_disabled_dark" />
    <item
        android:drawable="@drawable/common_signin_btn_icon_normal_dark" />
</selector>

这些资源文件在代码中的重要性如何?我可以只删除 XML 文件中的引用吗?

提前致谢

【问题讨论】:

    标签: android visual-studio-2012 xamarin android-drawable xml


    【解决方案1】:

    我可能迟到了,真诚地希望你现在已经解决了这个问题,但是对于像我这样经历过这个问题并在谷歌上发现帖子的人可能会发现它很有用。

    简单的答案:卸载软件包(或组件)并在确保不会达到文件路径错误的最大大小后重新安装。这应该可以修复丢失的资源。

    我在使用 Xamarin Studio 时也有过类似的经历。最初,文件路径对于 Windows(可能还有其他操作系统)来说太长了,并且包下载的 zip 不会解压缩。 IDE 提示我手动下载 zip,然后将其解压缩到适当的位置。这根本不够,因为我遇到了同样的错误。我重命名了几个文件夹以允许与包有关的荒谬子目录命名,并且在重新安装复制后,我收到了同样的错误。

    删除包并重新下载/安装包后,项目构建并且没有缺少的可绘制资源。

    相关来源: No resource found that matches the given name in common_signin_btn_icon_dark.xml http://forums.xamarin.com/discussion/comment/65525/#Comment_65525

    【讨论】:

      【解决方案2】:

      对上一个答案的轻微替代。我不想将我的项目移动到更小的路径,所以我创建了一个源自原始路径的虚拟目录。使用 DOS 命令

      SUBST y:C:\Users\USER\Documents\foldername\Projects

      虚拟目录 y:\ 指向源,但使用较短的路径。从虚拟目录打开项目意味着文件名长度等没有问题。

      CR

      【讨论】:

        【解决方案3】:

        我在 Android Studio 中遇到了同样的错误,问题是路径长,所以我将项目转移到另一个路径较小的分区并解决了错误

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-02-12
          • 2018-10-02
          • 1970-01-01
          相关资源
          最近更新 更多