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

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.

This question is related to android gradle target

The answer is


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.


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?


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.


In sdk Manager download android 5.1.1, it worked for me


Change

compileSdkVersion 18 minSdkVersion 10 targetSdkVersion 18

in build.gradle in your app directory/module

Or Download Latest API Version


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 .


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


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.


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

target=android-19


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

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to gradle

Gradle - Move a folder from ABC to XYZ A failure occurred while executing com.android.build.gradle.internal.tasks Gradle: Could not determine java version from '11.0.2' Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 Failed to resolve: com.android.support:appcompat-v7:28.0 Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0)

Examples related to target

failed to find target with hash string 'android-22' How to set child process' environment variable in Makefile Input button target="_blank" isn't causing the link to load in a new window/tab If conditions in a Makefile, inside a target The project was not built since its build path is incomplete jQuery: go to URL with target="_blank" Target elements with multiple classes, within one rule What does this symbol mean in IntelliJ? (red circle on bottom-left corner of file name, with 'J' in it) Can I create links with 'target="_blank"' in Markdown? How to change target build on Android project?