【问题标题】:Error:(20, 118) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_list_selector_disabled_holo_dark')错误:(20, 118) 未找到与给定名称匹配的资源(在 'drawable' 处,值为 '@drawable/abc_list_selector_disabled_holo_dark')
【发布时间】:2015-10-05 21:11:26
【问题描述】:

在 android (23) 上使用最新版本的 com.android.support:appcompat-v7:23.0.1com.android.support:design:23.0.1 em>

我收到以下错误

错误:(20, 118) 找不到与给定名称匹配的资源(在 具有价值的“可绘制” '@drawable/abc_list_selector_disabled_holo_dark')。

单击错误时,我看到我可以访问可绘制对象

在 stackoverflow 中的类似情况下,我发现版本号不匹配,例如 following case

我的 Gradle 文件如下所示:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "a.b.c.d.defg"
        minSdkVersion 7
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
}
}

【问题讨论】:

    标签: android android-appcompat


    【解决方案1】:

    我发现了这个问题,与上面的描述无关。

    感谢this question 中的@fvasquezc23 建议,我查看并发现我的路径超过了 255 个字符。

    我移动了项目位置并缩短了目录名称。

    很可能是给我错误的路径比路径限制长。

    很遗憾,我没有在我的问题中提供路径,因此很难提供好的建议。

    【讨论】:

    • 非常感谢分享。我在构建 jenkins 时遇到了类似的问题,一些目标正在运行,而另一些则没有,问题是它们的名称使路径超过 255 个字符。
    • 是的,使一般文件夹路径变短并且在文件夹名称中不包含任何特殊字符(即@字符)解决了这个问题。
    【解决方案2】:

    Ika 的回答很好。我遇到了完全相同的问题,通过缩短整个补丁程序(包括项目名称)来解决问题。

    【讨论】:

      【解决方案3】:

      您可以通过两种方式解决此问题:

      1。 将 Project 文件夹位置移至较短的目录名称。

      2。 Window 支持最大 260 个字符的文件路径。
      要允许超过 260 个字符,您需要在 windows 中进行注册表编辑

      转到 RegEdit -> 右键单击​​文件系统
      -> 选择新建 > DWORD(32 位)值
      -> 将新值命名为 LongPathsEnabled
      -> 在“数值数据”框中将值从 0 更改为 1 -> 按确定
      -> 重启电脑

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多