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.
Android Studio:
Open the
In the end you gradle-file will look like this:
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:
The only thing you have to do is to open the
Afterwards just do a
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
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.
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