71

enter image description here

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.

Hardik Pithva
  • 1,729
  • 1
  • 15
  • 31

10 Answers10

48

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.

Rick
  • 1,177
  • 1
  • 19
  • 27
MBH
  • 16,271
  • 19
  • 99
  • 149
  • 16
    Just 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
15

Open the Android SDK Manager and Update with latest :

  1. Android SDK Tools
  2. 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 .

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
5

Okay you must try this guys it works for me:

  1. Open SDK Manager and Install SDK build tools 22.0.1
  2. Sync gradle That'all
D.Kumar
  • 102
  • 7
4

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.

jaamit
  • 393
  • 3
  • 11
2

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.

user1252459
  • 563
  • 7
  • 7
0

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?

Atif Hussain
  • 880
  • 12
  • 19
0

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).

Ratna Halder
  • 1,954
  • 16
  • 17
-1

Change

compileSdkVersion 18 minSdkVersion 10 targetSdkVersion 18

in build.gradle in your app directory/module

Or Download Latest API Version

-1

In sdk Manager download android 5.1.1, it worked for me

Daniel J
  • 22
  • 2
-1

Open project.properties file and change the line with target=android-22 to the desired value.
For example:

target=android-19

Alan CN
  • 1,467
  • 1
  • 13
  • 13