How to resolve the error No resource found that matches the given name when adding library v7 AppCompat in Eclipse?
This is what you have to do for use the ActionBar support library correctly.
Follow the instructions in the Support Library Setup - Adding libraries with resources.
One thing that can bring some doubt is add the library to your aplicattion project:
(1) In the Project Explorer, right-click your project and select Properties.
(2) At the left pane select Android.
(3) At th bottom of the right pane click Add
(4) Select the library project android-support-v7-appcompat and click OK.
Click OK to close the properties window.
If you not get any of the errors I mentioned it´s all done.
However if you are like me, you dont´t followed the advice of Android team that suggests you always compile your source using the latest SDK, you get the error.
The error ocurrs because my Project Build Target was Android 2.3.3 and need to be at lest 3.0.
It was not immediately clear to me because of the fact that I'm specifically developing for Android 2.3.3 and I'm using support libraries.
OK, I hope this helps.
appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable'
While the answer of loeschg is absolutely correct I just wanna elaborate on it and give a solution for all IDE's (Eclipse, IntellJ and Android Studio) even if the errors differentiate slightly.
Prerequirements
Make sure that you've downloaded the latest extras
as well as the Android 5.0 SDK
via the SDK-Manager.
Android Studio
Open the build.gradle
or build.gradle.kts
file of your app-module and change your compileSdkVersion
to 21. It's basically not necessary to change the targetSdkVersion
SDK-Version to 21 but it's recommended since you should always target the latest android Build-Version.
In the end you gradle-file will look like this:
android {
compileSdkVersion(21)
// ...
defaultConfig {
// ...
targetSdkVersion(21)
}
}
Be sure to sync your project afterwards.
Eclipse
When using the v7-appcompat
in Eclipse you have to use it as a library project. It isn't enough to just copy the *.jar to your /libs
folder. Please read this (click) step-by-step tutorial on developer.android.com in order to know how to import the project properly.
As soon as the project is imported, you'll realize that some folders in the /res
folder are red-underlined because of errors such as the following:
error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.*'
error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Solution
The only thing you have to do is to open the project.properties
file of the android-support-v7-appcompat
and change the target from target=android-19
to target=android-21
.
Afterwards just do a Project --> Clean...
so that the changes take effect.
IntelliJ IDEA (not using Gradle)
Similiar to Eclipse it's not enough to use only the android-support-v7-appcompat.jar
; you have to import the appcompat
as a module. Read more about it on this StackO-Post (click).
(Note: If you're only using the .jar
you'll get NoClassDefFoundErrors
on Runtime)
When you're trying to build the project you'll face issues in the res/values-v**
folders. Your message window will say something like the following:
Error:android-apt-compiler: [appcompat] resource found that matches the given name: attr 'android:colorPrimary'.
Error:(75, -1) android-apt-compiler: [appcompat] C:\[Your Path]\sdk\extras\android\support\v7\appcompat\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'.
// and so on
Solution
Right click on appcompat
module --> Open Module Settings (F4) --> [Dependency Tab] Select Android API 21 Platform from the dropdown --> Apply
Then just rebuild the project (Build --> Rebuild Project) and you're good to go.
Eclipse Android plugin issue Error: No resource found that matches the given name (at 'theme' with value '@style/AppTheme')
This is due to the bug in the adt plugin, Download the patch from http://tools.android.com/download/adt-issue-82393-v4.zip?attredirects=0&d=1 and install the adt plugin manually from .zip file (https://code.google.com/p/android/issues/detail?id=82393).
For Manual Installation please follow How to install plugin for Eclipse from .zip
Error retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23
Your compile SDK version must match the support library's major version.
Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.
Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.
Error using eclipse for Android - No resource found that matches the given name
Accidentally moved the "values" folder outside of the "res" folder. Moved it back and it fired up!
Related Topics
How to Get Code Coverage Using Android Studio
How to Install Android Studio on Ubuntu
How to Implement Zoom Effect for Image View in Android
Why to Use Handlers While Runonuithread Does The Same
Why Do Listview Items Not Grow to Wrap Their Content
Android, How to Limit Width of Textview (And Add Three Dots at The End of Text)
How Do The Android Support Libraries Work
Create a Custom View by Inflating a Layout
What's "Requestcode" Used for on Pendingintent
Android Studio Two Flavors with Different Manifest Files
What Are Best Practices for Using Aes Encryption in Android
Change The Background Color of a Pop-Up Dialog
Android Webview Jellybean -> Should Not Happen: No Rect-Based-Test Nodes Found
How to Create Android Project with Gradle from Command Line
How to Declare an Extended Height Toolbar/Action Bar on Android Lollipop