Ich versuche, das Android-Projekt zu erstellen, das die appcompat_v7-Bibliothek verwendet.
Dafür habe ich mein Projekt über Eclipse -> Neues Android-Beispielprojekt erstellt, meine benutzerdefinierte styles.xml hinzugefügt und dann die appcompat_v7-Bibliothek Project -> Properties -> Android -> Add hinzugefügt.
Ich erhalte jedoch folgende Fehler in appcompat_v7/res/values / styles_base.xml, wenn ich mein Projekt kompiliere:
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'.
In meinem Manifest habe ich 14 als meine minSdkVersion und 19 als targetSdkVersion deklariert:
AndroidManifest.xml:
<uses-sdk
Android:minSdkVersion="14"
Android:targetSdkVersion="19" />
Was kann ich tun, um diese Fehler zu beheben und mein Projekt zu erstellen?
Überprüfen Sie das Build-Ziel Ihres Projekts und Ihres appcompat_v7-Bibliotheksprojekts. Sie sollten gleich sein, wenn Ihr Projekt weniger Build-Ziel hat als Sie diesen Fehler erhalten und nicht bauen können.
Um das Problem in Eclipse zu beheben, gehen Sie zu Projekt-> Eigenschaften-> Android (Projekterstellungsziel) und wählen Sie gleich Ihrem Appcompat-Bibliotheksprojekt.
Wiederholen Sie die obigen Schritte für Ihr Projekt.
Bei Verwendung der Bibliothek appcompat_v7 sollte targetSdkVersion dieselbe Nummer wie die Hauptversionsnummer der Android Support Library haben. Z.B. Bei meiner SDK-Installation ist die Versionsnummer 23.0.1, und meine targetSdkVersion sollte 23 sein (Android 6.0).
Ich bin gerade auf ein ähnliches Problem gestoßen, als ich appcompat-v7 von 22.2.0 23.1.0 aktualisiert habe. Durch das Aktualisieren von compileSdkVersion auf 23 wurde es behoben.
Versuchen Sie Folgendes: https://www.youtube.com/watch?v=HpXoCfoX_QY
Stellen Sie außerdem sicher, dass Ihre Bibliothek "appcompat_v7" geöffnet ist und die Ordner angezeigt werden.