I have updated android studio with latest version and then after googling I also updated Android SDK with API 18 but still it gives the same error.
-
1Change Grandle.build file from 18 to 17.may work – Sree Sep 22 '15 at 11:21
-
Gradle actually looks like this.... compileSdkVersion 22.... minSdkVersion 10.....targetSdkVersion 22 – Hardik Pithva Sep 22 '15 at 11:28
-
ok sorry then make it to 21 – Sree Sep 22 '15 at 11:30
-
It worked perfectly fine but do i have to change targetSdkVersion as well ? and dependencies are based on 22 SDk whicg gives error now... – Hardik Pithva Sep 22 '15 at 11:38
-
ok now try with 22 hope it work – Sree Sep 22 '15 at 11:39
-
if not work change the compileSdkVersion 21 only let the targetSdkVersion 22 be like this – Sree Sep 22 '15 at 11:41
-
Nope it is giving the same error if i change it to 22. I just kept the same... Thanks – Hardik Pithva Sep 22 '15 at 11:42
10 Answers
Just click on the link written in the error:
Open Android SDK Manager
and it will show you the dialogs that will help you to install the required sdk for your project.
-
16Just installing an older SDK version is not the real solution! The real solution is to go through all of your gradle config files and upgrade the *version settings to your latest installed one, e.g. `compileSdkVersion 23` – electronix384128 Jan 26 '16 at 19:14
-
I'd already installed version 22 using the sdk manager & still no luck (e.g. clicking on the link didn't do anything). So I closed, and then re-opened android studio & that worked. – Reece Mar 31 '16 at 14:38
-
@BenMarten upgrading to the latest sdk may not help sometimes. One of projects i imported was using some `Apache Http` classes which was existed in sdk v19 and deprecated in >21. So let the project install the required sdk, then if needed you can upgrade it. – MBH Jun 10 '16 at 05:56
-
Thank you @BenMarten i already got them, but since i wanted to get the project working asap, i did used the solution that i have posted, then i searched on google for the alternatives of apache http classes. – MBH Jun 10 '16 at 19:22
-
On my mac, I installed the SDK from the link, then Gradle run after a complete restart of Android studio. – Adam Delarosa Jan 15 '17 at 22:49
Open the Android SDK Manager
and Update with latest :
- Android SDK Tools
- Android SDK Build Tools
Then Sync ,Re-Build and Restart Your Project
Demo Code for build.gradle
compileSdkVersion 21 // Now 23
buildToolsVersion '21.1.2' //Now 23.0.1
defaultConfig
{
minSdkVersion 15
targetSdkVersion 19
}
Hope this helps .

- 74,896
- 15
- 165
- 198
-
So you're suggesting to change it to 23, in this example, assuming that's the latest? – rogerdpack Oct 17 '17 at 04:43
Okay you must try this guys it works for me:
- Open SDK Manager and Install SDK build tools 22.0.1
- Sync gradle That'all

- 102
- 7
-
No, just installing an older SDK version is not the real solution, as commented elsewhere. – Reg Edit Apr 17 '17 at 21:34
I modified build.gradle compileSdkVersion to 23 from 22 and targetSdkVersion to 23 from 22.
My API level was 23. I had to update the API version to 23 as well.
I had to import my project from Eclipse to Android Studio. It worked for me.

- 393
- 3
- 11
I had similar issue. I updated android studio build tools and my project didn't find "android-22". I looked in android sdk manager and it was installed.
To fix this issue I uninstalled "android-22" and installed again.

- 563
- 7
- 7
I created a new Cordova project, which created with latest android target android level 23. when i run it works. if i changed desire android target value from 23 to 22. and refresh the Gradle build from the Andoid Studio. now it's fail when i run it. i got the following build error.
project-android /CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java Error:(217, 22) error: cannot find symbol method requestPermissions(String[],int)
I changed the target level in these files.
project.properties
AndroidManifest.xml
and inside CordovaLib folder.
project.properties
However, i also have another project which is using the android target level 22, whenever i run that project, it runs. Now my question is can we specify the desire android level at the time of creating the project?

- 880
- 12
- 19
I think you should install API 18 from android sdk if not already installed, otherwise you can try "invalidate caches and restart" (Find: File->invalidate caches and restart).

- 1,954
- 16
- 17
Change
compileSdkVersion 18 minSdkVersion 10 targetSdkVersion 18
in build.gradle in your app directory/module
Or Download Latest API Version

- 64
- 5
-
-
:) Always Welcome.Please Build the build.gradle file after Changing – Tyler Durden Sep 22 '15 at 11:54
Open project.properties file and change the line with target=android-22 to the desired value.
For example:
target=android-19

- 1,467
- 1
- 13
- 13