2014-04-22 13 views
15

Sto provando a creare il progetto Android che utilizza la libreria appcompat_v7.appcompat_v7: Errore nel recupero del genitore per l'articolo: Nessuna risorsa trovata che corrisponde al nome specificato

Per questo, ho creato il mio progetto tramite Eclipse -> Nuovo progetto di esempio Android e aggiunto il mio styles.xml personalizzato e poi aggiunto la libreria appcompat_v7 Progetto -> Proprietà -> Android -> Aggiungi.

Ma sto ottenendo i seguenti errori in appcompat_v7/res/Valori/styles_base.xml Quando compilo il mio progetto:

appcompat_v7/res/values/styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'. 

appcompat_v7/res/values/styles_base.xml:84: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'. 

appcompat_v7/res/values/styles_base.xml:166: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'. 

appcompat_v7/res/values/styles_base.xml:243: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'. 

appcompat_v7/res/values/styles_base.xml:261: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base.DropDownItem'. 

appcompat_v7/res/values/styles_base.xml:319: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'. 

appcompat_v7/res/values/styles_base.xml:323: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.Base'. 

appcompat_v7/res/values/styles_base.xml:347: error: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Base'. 

appcompat_v7/res/values/styles_base.xml:391: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'. 

appcompat_v7/res/values/themes_base.xml:189: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Base'. 

Nel mio manifesto ho dichiarato il 14 come il mio minSdkVersion e 19 come targetSdkVersion:

AndroidManifest.xml:

<uses-sdk 
     android:minSdkVersion="14" 
     android:targetSdkVersion="19" /> 

che cosa posso fare per risolvere questi errori e costruire il mio progetto?

risposta

18

Controllare il target di costruzione del progetto e il progetto di libreria appcompat_v7. Dovrebbero essere uguali, se il tuo progetto ha un Build Target inferiore di quello che ottieni e non sarà in grado di costruire.

Per risolvere il problema in Eclipse, andare su Progetto-> Proprietà-> Android (Target di costruzione progetto) e selezionare uguale al progetto della libreria di appcompat.

12
  1. Fare clic con il pulsante destro del mouse sulla libreria di supporto;
  2. Fare clic su Proprietà;
  3. Sul lato sinistro fare clic su "Android";
  4. Selezionare il corretto "Android 5.0 - API 21" e fare clic su OK;
  5. Pulire la libreria di supporto: Progetto -> Pulisci;

Ripetere i passaggi precedenti per il progetto.

-1

Controllare se sono aggiornati gli strumenti di Android Support Library e Android SDK Build-tools e Android SDK Platform. Ho aggiornato Android Support Library e non Build-tools e questo errore è apparso. Dopo aver aggiornato gli strumenti Build, è stato risolto.

2

Quando si utilizza la libreria appcompat_v7, targetSdkVersion deve essere lo stesso numero del numero di versione della libreria di supporto Android principale. Per esempio. sulla mia installazione di SDK il numero di versione è 23.0.1 e quindi targetSdkVersion dovrebbe essere 23 (Android 6.0)

1

Ho appena avuto un problema simile durante l'aggiornamento di appcompat-v7 da 22.2.0 23.1.0. Aggiornare compileSdkVersion a 23 risolto.

Problemi correlati