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

后端 未结 10 1172
花落未央
花落未央 2020-11-27 20:16

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.

相关标签:
10条回答
  • 2020-11-27 20:22

    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 .

    0 讨论(0)
  • 2020-11-27 20:23

    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
    0 讨论(0)
  • 2020-11-27 20:25

    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?

    0 讨论(0)
  • 2020-11-27 20:31

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

    0 讨论(0)
  • 2020-11-27 20:31

    In sdk Manager download android 5.1.1, it worked for me

    0 讨论(0)
  • 2020-11-27 20:32

    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.

    0 讨论(0)
提交回复
热议问题