I want to change my compileSdkVersion from 23 to 21.So I have made following changes in the build.gradle but I am getting following error.How can I resolve this?
failed to find target with hash string 'android-21'
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.shalabh.fly"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile files('libs/httpclient-4.1-beta1.jar')
}
Go to you Android SDK dir and install it properly:
tools/android update sdk
or
tools/android update sdk --no-ui
You are using
compile 'com.android.support:appcompat-v7:23.0.1'
So you have to compile with API 23.
Change your compileSdkVersion
in your build.gradle
file
compileSdkVersion 23
Below is for Android studio 1. Go to app -> build.gradle -> change "compileSdkVersion 'installed sdk version'"
That's it, problem solved:-)
Note: I think this might be a bug in Android Studio.
If this not work, then:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With