appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable' in Android

If you faced appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable' error on during developing android application.

Here is the solution in Android studio, Eclipse and  IntelliJ IDEA.

Prerequirements
Make sure that you've downloaded the latest extras as well as the Android 5.0 SDK via the SDK-Manager.
Picture of 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.
Android Studio Gradle Sync reminder


Eclipse:

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:

Right click on appcompat module --> Open Module Settings (F4) --> [Dependency Tab] Select Android API 21 Platform from the dropdown --> Apply
Select API 21 Platform
Then just rebuild the project (Build --> Rebuild Project) and you're good to go.

Sometimes , If above solution doesnot work then try this
Haven't set compileSdkVersion to 21 in your build.gradle file and change targetSdkVersion to 21.
android {
    //...
    compileSdkVersion 21

    defaultConfig {
        targetSdkVersion 21
    }
    //...
}
This requires you to have downloaded the latest SDK updates to begin with.
Android Studio SDK Manager
Once  downloaded all the updates (don't forget to also update the Android Support Library/Repository, too!) and updated your compileSdkVersion, re-sync Gradle project.
Edit: For Eclipse or general IntelliJ users


Happy Coding!!!

appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable' in Android appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable' in Android Reviewed by D Kshetri on 10:04 PM Rating: 5

No comments:

Powered by Blogger.