5

Am trying to add the Design support Library following this guidelines https://github.com/codepath/android_guides/wiki/Design-Support-Library and i'm having issues.

dependencies {
          compile 'com.android.support:appcompat-v7:22.2.0'
} 

Trying to add this and Its giving me lots of XML errors when building.

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

This is the build.gradle below

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'
}
Tosin Onikute
  • 3,883
  • 6
  • 38
  • 61

4 Answers4

11

I got this error when the filename was too long.

If you are running under windows, your build/intermediates/... files can get very long. You will get an odd error like this one if that happens.

Brian Donovan-Smith
  • 392
  • 1
  • 5
  • 13
2

I solved this by adding multiDexEnabled true in defaultConfig in gradle file.

And by adding

 dexOptions {
        javaMaxHeapSize "4g"
    }

after defaultConfig.

Abhishek Balani
  • 3,827
  • 2
  • 24
  • 34
1

Since I ran into the same problem and there is no complete answer, I'll post it.

As @Brian Donovan-Smith mentioned, the problem occurs when one or more file names is too long (more than 260 characters). It is worth to note that the name includes the entire path. So, that was the problem in my case, and I solved it by moving the source folders to a closer to C: location.

Ari
  • 3,086
  • 1
  • 19
  • 27
0

Make sure you downloaded the files on your computer via SDK manager like in this guide: https://developer.android.com/tools/support-library/setup.html (Scroll down to "Adding libraries with resources")

Gradle alone won't do it, you need to download via SDK manager additoionally as this library inlcudes ressources:

Some Support Libraries contain resources beyond compiled code classes, such as images or XML files. For example, the v7 appcompat and v7 gridlayout libraries include resources.

Maximosaic
  • 604
  • 6
  • 14