failed to find target with hash string 'android-22'
AndroidGradleTargetAndroid Problem Overview
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 :
- 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 .
Solution 3 - Android
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
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