2015-06-19 13 views
5

Sto cercando di aggiungere la libreria di supporto di progettazione seguendo queste linee guida https://github.com/codepath/android_guides/wiki/Design-Support-Library e sto avendo problemi.Nessuna risorsa trovata Errori per il supporto: appcompat-v7: 22.0.0 su Android Studio

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

Cercando di aggiungere questo e la sua mi dà un sacco di errori XML quando si costruisce.

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 

Questa è la build.gradle sotto

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' 
} 
+0

Questi valori sono nel file estraibile? Hai provato Build -> clean? –

+1

Abbreviare il percorso della directory al progetto – Yashwanth

+0

@Yashwanth come abbreviare il percorso della directory se si trova all'interno della cartella intermedia –

risposta

0

Assicurarsi che si è scaricato il file sul computer tramite SDK Manager come in questa guida: https://developer.android.com/tools/support-library/setup.html (scorrere fino a "librerie Aggiunta con le risorse")

Gradle da solo non lo farà, è necessario scaricare tramite SDK Manager additoionally come questa biblioteca inlcudes ressources:

Alcune librerie di supporto contengono risorse oltre le classi di codice compilate, come immagini o file XML. Ad esempio, le librerie v7 appcompat e v7 gridlayout includono risorse.

11

Ho ricevuto questo errore quando il nome del file era troppo lungo.

Se si esegue Windows, i file di build/intermedi/... possono richiedere molto tempo. Avrai uno strano errore come questo se ciò accade.

+0

Non vorrei ricordare che questo potrebbe essere un problema. Ha funzionato per me, grazie. –

+0

@EdisonSpencer come hai risolto? –

+0

@JanardhanR Non ricordo bene, ma credo di aver spostato la posizione del progetto per essere più vicino alla directory su cui stavo lavorando (Windows). –

1

Dal momento che mi sono imbattuto nello stesso problema e non c'è una risposta completa, lo posterò.

Come ha detto @Brian Donovan-Smith, il problema si verifica quando uno o più nomi di file sono troppo lunghi (più di 260 caratteri). Vale la pena notare che il nome include l'intero percorso. Quindi, questo era il problema nel mio caso, e l'ho risolto spostando le cartelle di origine in C: location.

2

Ho risolto questo problema aggiungendo multiDexEnabled true in defaultConfig nel file gradle.

E con l'aggiunta di

dexOptions { 
     javaMaxHeapSize "4g" 
    } 

dopo defaultConfig.

+0

Questo non ha risolto il problema per me. Solo un fyi. – Silmarilos

Problemi correlati