Failed to find target with hash string 'android-25'

Android

Android Problem Overview


I have Android Studio 2.2. I am trying to open a project, but I get the error "Failed to find target with hash string 'android-25'". Below the error message I see a link "Install missing platform(s) and sync project". If I click this link, I get another error, which says

> "The following packages are not available: - Package id > platforms;android-25".

In the Android SDK tool, I can see "Android 7.0" (API level 24) already installed. On checking the details about Android verisons and its API levels, I found that Android Nougat has API levels 24-25. I would like to know how I can update the SDK from API24 to 25?

Android Solutions


Solution 1 - Android

You don't need to update anything. Just download the SDK for API 25 from Android SDK Manager or by launching Android standalone SDK manager. The error is for missing platform and not for missing tool.Android SDK Manager Android Studio 2.2.2

Solution 2 - Android

Well, I was suffering with this Issue but finally I found the solution.

Problem Starts Here: ["Install missing platform(s) and sync project" (link) doesn't work & gradle sync failed]

Problem Source: Just check out the app -> src-build.gradle and you will find the parameters

  1. compileSdkVersion 25

  2. buildToolsVersion "25.0.1"

  3. targetSdkVersion 25

Note: You might find these parameters with different values e.g compileSdkVersion 23 etc.

These above parameters in build.gradle creates error because their values are not compatible with your current SDK version.

The solution to This error is simple, just open a new project in your Android Studio, In that new project goto app -> src-build.gradle.

In build.gradle file of new project find these parameters:

enter image description here

In my case these are:

compileSdkVersion "26"    
buildToolsVersion "26.0.1"
targetSdkVersion 26

Now copy these parameters from your new project build.gradle file and post them in the same file of the other project(having Error).

Solution 3 - Android

I got similar problem

1: I tried to resolve with the answer which is marked correct above But I was not able to get the system setting which was quit amazing (On MacBook).

Most of the time such errors & issues comes because of replacing your grade file with other grade file ,due which gradel does not sync properly and while building the project issue comes . The issue is bascially related to non syncing for platform tools

Solution a: Go to File and then to Your project strucutre -modules -app-Properties -build tool version -click on options which is required for your project (if required build tool version not there chose any other). This will sync the grade file and now you can go to gradel and change target version and build tool version as per your requirement .you will prompted to download the required platform tool to sync it , now click on install tool version and let project to build

Solution b: Try Anuja Ans if you can get option of system setting and install platform tool.

Solution 4 - Android

Make sure your computer is connected to the internet, then click on the link that comes with the error message i.e "install missing platform(s) and sync project". Give it a few seconds especially if your computer has low specs, it will bring up a window called SDK Quickfix Installation and everything is straightforward from there.

Solution 5 - Android

I got same exception while running gradle build for my android project.

Caused by: java.lang.IllegalStateException: Failed to find target with hash string 'android-27'

This issue related to android SDK version enable for your Android Studio. Please find the solution of this problem from attached screen. enter image description here

Solution 6 - Android

You can open the SDK standalone by going to installation directory, just right click on the SDK Manager.exe and click on run as Administrator. i hope it will help.

Solution 7 - Android

the default gradle version 3.3 may have some bugs, I switched to gradle 3.5 and everything got ok

Solution 8 - Android

I have got same error for Android-28. In SDK manager - SDK Platform it shows me that Android API 28 is partially installed and no further updates available. so that I updated ANDROID-SDK-BUILD-TOOLS from SDK Tools and after restarting project. It will work. This might be helpful for other who faces same issue as I faced.

Solution 9 - Android

It seems like that it is only me who are so clumsy, because i have yet to found a solution that my case required.

I am developing a multi-modular project, thus base android module configuration is extracted in single gradle script. All the concrete versions of sdks/libs are also extracted in a script.

A script containing versions looked like this:

...

ext.androidVersions = [
    compile_sdk_version     : '27',
    min_sdk_version         : '19',
    target_sdk_version      : '27',
    build_tool_version      : '27.0.3',
    application_id          : 'com.test.test',
]

...

Not accustomed to groovy syntax my eye has not spotted that the values for compile, min and target sdks were not integers but STRINGS! Therefore a compiler rightfully complained about not being able to find an sdk a version of which would match HASH STRING '27'.

So the solution would be to make sdk's versions integers: ...

ext.androidVersions = [
    compile_sdk_version     : 27,
    min_sdk_version         : 19,
    target_sdk_version      : 27,
    build_tool_version      : '27.0.3',
    application_id          : 'com.test.test',
]

...

Solution 10 - Android

I had similar issue for android-29. My issue occurred because when AS was unzipping one downloaded SDK I had stopped it. For solving the issue disable gradle offline mode then sync with gradle files. You may need to set proxy and enable it.

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
QuestionKurioZ7View Question on Stackoverflow
Solution 1 - AndroidAnuja KothekarView Answer on Stackoverflow
Solution 2 - AndroidHasnat ShahView Answer on Stackoverflow
Solution 3 - AndroidadityaView Answer on Stackoverflow
Solution 4 - Androidadeshina.OView Answer on Stackoverflow
Solution 5 - AndroidRajeev RathorView Answer on Stackoverflow
Solution 6 - AndroidSyed JunaidView Answer on Stackoverflow
Solution 7 - Androidbowman hanView Answer on Stackoverflow
Solution 8 - AndroidNikView Answer on Stackoverflow
Solution 9 - AndroidKirill StarostinView Answer on Stackoverflow
Solution 10 - AndroidMMGView Answer on Stackoverflow