Mehran Mehran - 1 year ago 99
Android Question

Changing compileSdkVersion in Android Studio Is Giving an Error

I'm testing an app in Android Studio for which I need to use

lower than 23, but the current version of
in Android Studio is 23 by default. I downloaded and installed
Android SDK build-tools
revision 22 and changed it in
as follows:

android {
compileSdkVersion 22
buildToolsVersion "23.0.1"

but I'm getting this error:

cause: failed to find target with hash string 'android-22'

I've looked at a few similar questions but none helped me with this.

What should I do?

Answer Source

I found the answer to the issue... when I set the compileSdkVersion and buildToolsVersion through file => project structure => (module) app, they were set in the build.gradle accordingly as below:

compileSdkVersion 22
buildToolsVersion "22.0.1"

And I thought that the dependencies section should be like this(i.e versions being the same as that of buildToolsVersion):

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile ''
compile ''


but after a lot of research I found out that there is no version as 22.0.1 for the appcompat-v7... The version which I used for appcompat-v7 and design which worked is 22.2.1. So, that was it!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download