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

AndroidGradleTarget

Android Problem Overview


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.

Android Solutions


Solution 1 - Android

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.

Solution 2 - Android

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 .

Solution 3 - Android

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

Solution 4 - Android

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.

Solution 5 - Android

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.

Solution 6 - Android

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?

Solution 7 - Android

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

Solution 8 - Android

Change

compileSdkVersion 18 minSdkVersion 10 targetSdkVersion 18

in build.gradle in your app directory/module

Or Download Latest API Version

Solution 9 - Android

In sdk Manager download android 5.1.1, it worked for me

Solution 10 - Android

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHardik PithvaView Question on Stackoverflow
Solution 1 - AndroidMBHView Answer on Stackoverflow
Solution 2 - AndroidIntelliJ AmiyaView Answer on Stackoverflow
Solution 3 - AndroidD.KumarView Answer on Stackoverflow
Solution 4 - AndroidjaamitView Answer on Stackoverflow
Solution 5 - Androiduser1252459View Answer on Stackoverflow
Solution 6 - AndroidAtif HussainView Answer on Stackoverflow
Solution 7 - AndroidRatna HalderView Answer on Stackoverflow
Solution 8 - AndroidTyler DurdenView Answer on Stackoverflow
Solution 9 - AndroidDaniel JView Answer on Stackoverflow
Solution 10 - AndroidAlan CNView Answer on Stackoverflow