Harikrishnan
Harikrishnan

Reputation: 1474

Got error while building android project in new workspace

Am new for android development. Am using eclipse for creating android projects. I tried to create a new sample in a newly created workspace with Target SDK as API 21 and Compiled with API 19. I have installed the SDKs of API 19 and 20 and all its updates. While trying to compile the newly created project I ended up with the below error. Can anyone help me how to get rid of this?

Description Resource    Path    Location    Type
error: **Error retrieving parent for item: No resource found that matches the given name** '@android:TextAppearance.Material.SearchResult.Subtitle'.    styles_base.xml /appcompat_v7/res/values-v21    line 168    Android AAPT Problem
Description Resource    Path    Location    Type
error: Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Title'.   styles_base.xml /appcompat_v7/res/values-v21    line 164    Android AAPT Problem
Description Resource    Path    Location    Type
error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'. styles_base_text.xml    /appcompat_v7/res/values-v21    line 38 Android AAPT Problem
error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'. styles_base_text.xml    /appcompat_v7/res/values-v21    line 36 Android AAPT Problem

and so on....... I dont know what went wrong. Can anyone guide me in building the project successfully?

Upvotes: 1

Views: 1807

Answers (2)

Rob Meeuwisse
Rob Meeuwisse

Reputation: 2937

I had the same or similar errors when I tried to compile the GCM Client sample.

I solved it by specifying the correct version in build.gradle. Change:

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

to

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

I suppose it's best to set the version number for your dependencies to be the same as your targetSdkVersion.

It took me quote some time to figure out and the irony is that Android Studio was already hinting at it: "Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds."

update

I just realized you said you "are using Eclipse" which I don't know at all. I suppose you should look for the mechanism where you pull in the app-compat dependency and tell it to use a specific version instead of the newest. Hopefully others can tell you where that is.

Upvotes: 0

Mixaz
Mixaz

Reputation: 4178

See http://code.google.com/p/android/issues/detail?id=72991#c8 :

Delete the values-v21 folder on app/src/main/res/, it is not important if you are not using android-L

The above is for Android Studio, For Eclipse it's just in res subfolder of project root.

Also you can try to build with SDK 21, as mentioned here: https://stackoverflow.com/a/26437523/1028256 and https://stackoverflow.com/a/24437408/1028256

Seems that the New Project Wizard in Eclipse generated files for SDK 11, including files for appcompat-v7, so you either need to compile with API 21, or remove those files from the project.

Upvotes: 1

Related Questions