I\'ve always programmed Android with Eclipse and decided to start migrating to Android Studio. I decided to use the same SDK I already had for Eclipse, then:
In my case it was an higher version of Google-play-services. I set them to 7.0.0 (not 8.x) and all was ok.
As others have already mentioned your compile sdk version
must match your support library's
major version. This is however, also relevant for subprojects
should you have any.
In case you do, you can set your subprojects
compile sdk versions with the following script:
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
Add this script in your root build.gradle
file.
I wanted to downgrade from API 23 to 22 and got this error. I had to change all build.gradle
files in a project in order to compile.
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.yourapp.app"
minSdkVersion 14
targetSdkVersion 22
}
...
dependencies {
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
}
Another solution : navigate to
\sdk\extras\android\m2repository\com\android\support\appcompat-v7\23.x.x
open .aar
file with 7-zip or winrar , in res folder remove values-23
folder and save changes .
Everything is great but none of you explained where to download the SDK build tools
Upgrade Android Studio.
I had this issue with Android Studio 1.3.1 and none of the other answers worked for me, but after updating to 1.5.1 there were no problems.