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
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.
No resource found that matches the given name: attr 'android:actionModeShareDrawable'
You need to make sure all your modules that have the support library as dependency also have the compile SDK set to 21. So go to Project Structure and check all the modules on the left hand side.
Error:(2367, 40) No resource found that matches the given name (at 'colorButtonNormal' with value '@color/blue_grey_500')
Just add the color manually in your colors.xml
<color name="blue_grey_500">#9E9E9E</color>
Android Studio : No resource found that matches the given name: attr 'android:actionModeShareDrawable'
I found the answer for this
The AppCompat library was already installed
but the App was compiling under Android 19 which cases this issue
to resolve this I compiled under Android 21
Error:(86, 50) No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/tvComment')
You are passing your id without +
sign, Read your error carefully No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/tvComment').
pass your id like
mistake is here
android:layout_toLeftOf="@id/tvStar"
change it like
android:layout_toLeftOf="@+id/tvStar"
Related Topics
Android: View.Setid(Int Id) Programmatically - How to Avoid Id Conflicts
How to Filter a Recyclerview With a Searchview
Fullscreen Activity in Android
How to Avoid Concurrency Problems When Using Sqlite on Android
Error in Launching Avd With Amd Processor
Exception 'Open Failed: Eacces (Permission Denied)' on Android
How to Determine When Fragment Becomes Visible in Viewpager
Get Filename and Path from Uri from Mediastore
Simple Android Recyclerview Example
Is There an Addheaderview Equivalent For Recyclerview
How to Use Getdownloadurl in Recent Versions
How to Format Date and Time in Android
How to Filter Specific Apps For Action_Send Intent (And Set a Different Text For Each App)
How to Prevent Custom Views from Losing State Across Screen Orientation Changes