找不到资源支持错误:Android Studio上的appcompat-v7:22.0.0

Htm*_*sin 5 android android-appcompat build.gradle

我试图按照这个指南添加设计支持库https://github.com/codepath/android_guides/wiki/Design-Support-Library,我遇到了问题.

dependencies {
          compile 'com.android.support:appcompat-v7:22.2.0'
} 
Run Code Online (Sandbox Code Playgroud)

试图添加这个,它在构建时给了我很多XML错误.

Error:(24, 63) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_textfield_default_mtrl_alpha').
Error:(25, 93) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_textfield_default_mtrl_alpha').
Error:(26, 33) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_textfield_activated_mtrl_alpha').

Error:(20, 118) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_list_selector_disabled_holo_dark').
Error:(21, 118) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_list_selector_disabled_holo_dark').
Error:(20, 118) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_list_selector_disabled_holo_light').
Error:(21, 118) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_list_selector_disabled_holo_light').

Error:(18, 29) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_list_pressed_holo_light').
Error:(22, 118) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_list_selector_disabled_holo_dark').
Error:(23, 118) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_list_selector_disabled_holo_dark').

Error:(22, 118) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_list_selector_disabled_holo_light').
Error:(23, 118) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_list_selector_disabled_holo_light').
Error:(19, 27) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_btn_rating_star_off_mtrl_alpha').
Error:(21, 27) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_btn_rating_star_off_mtrl_alpha').

Error:(23, 27) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_btn_rating_star_on_mtrl_alpha').
Error:(19, 29) No resource found that matches the given name (at 'drawable' with value '@drawable/abc_btn_switch_to_on_mtrl_00001').

Information:BUILD FAILED
Run Code Online (Sandbox Code Playgroud)

这是下面的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.hp.navigationexercise"
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:support-annotations:22.2.0'
    compile 'com.android.support:design:22.2.0'
    compile 'com.android.support:recyclerview-v7:22.2.0'
}
Run Code Online (Sandbox Code Playgroud)

Bri*_*ith 11

文件名太长时,我收到此错误.

如果您在Windows下运行,您的构建/中间件/ ...文件可能会变得很长.如果发生这种情况,你会得到像这样的奇怪错误.


Max*_*aic 0

确保您通过 SDK 管理器将文件下载到计算机上,如本指南所示: https: //developer.android.com/tools/support-library/setup.html (向下滚动到“添加带有资源的库”)

仅 Gradle 无法完成此操作,您需要通过 SDK 管理器另外下载,因为该库包含资源:

某些支持库包含已编译代码类之外的资源,例如图像或 XML 文件。例如,v7 appcompat 和 v7 gridlayout 库包含资源。