I am a totally newbie who just got into Android development. I am going through the \"Building your first app
\" tutorial on the official Android developer webpa
This is because of Eclipse and SDK relation upon the "appcompact_v7" library project.
When we create a new Android Application Project, eclipse try to add a library(appcompact_v7) project for it.If we create our project with target 19 (API 19), eclipse will also generate the appcompact_v7 library project with API 19. When we clean and build the application, we got error like as follow:
....\appcompat_v7\res\values-v21\styles_base.xml:75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
....\appcompat_v7\res\values-v21\styles_base.xml:79: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
....\appcompat_v7\res\values-v21\styles_base.xml:83: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
....\appcompat_v7\res\values-v21\styles_base.xml:25: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
....\appcompat_v7\res\values-v21\styles_base.xml:29: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Why? Because when eclipse create appcompact_v7, it retrieve all reference for every SDK version from your SDK manager. So, in appcompact_v7, there will be reference for SDK which is greater than API 19.
Ok, check this part in the log: appcompat_v7\res\values-v21\styles_base.xml:75
. That shown, it can't compile reference for values-v21
(means target 21(API 21)). Therefore, it shown error like that.
So, what we need to do. We need to do is, the compile target for appcompact_v7 project always must be the latest API of the related SDK.
I also found this error because my latest is API 23 and I compile it wit API 22. So, I got this error:
....\appcompat_v7\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
....\appcompat_v7\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
So, I change the android target in project.properties
of appcompact_v7 to latest as follow:
Also in project.properties
of project as follow:
After that, I clean and compile the project. It has shown no error.
I found the source of the problem, when we create a new project, it contains the reference of the appcompat_v7
library:
the appcompat_v7
library already contains the support library "android-support-v4.jar
"
the problem is that the new project created contains into the /libs
folder, the library "android-support-v4.jar
" too!, just delete this .jar from your new project ( that is already contained into the appcompat_v7
library)
don´t forget to clean and build your project
This problem happens using API 19 use API 21 or later
See if this helps:
One anther thing you ca try is to open the project.properties file of the android-support-v7-appcompat and change the target target=android-21 (latest). Afterwards just do a Project --> Clean... so that the changes take effect.
For your information, my target SDK is API19 and I am also compiling it with API19
Use API21 (or greater) for target and compile.
API 19 does no know the material stuff that is missing.
To do this with Eclipse, set your own project to target API21 (or greater): open Project Properties and in the Android pane, specify Project Build Tagret as API21 (or greater). When Project Build Tagret of your own project is below 21, errors in the question appear. Clean and re-build your own project when modified its Project Build Tagret.
Update the project.properties file of appcompat v7, which has:target=android-19
to target=android-21
Also update google play services
library