Skip to content

(on Windows 10) Failed to find target with hash string 'android-28' in Android\Sdk #26439

@rahamin1

Description

@rahamin1

React Native version:

React Native Environment Info:
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Memory: 1.10 GB / 7.87 GB
Binaries:
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD

Steps To Reproduce

  1. Install android studio
  2. Go the project's folder and type npm install and then react-native run-android

Describe what you expected to happen:

Successful build

Describe what happened:

When executing react-native run-android I am getting an error that is mentioned in multiple questions in stack overflow. However, none of the proposed solutions works for me.

I am using Windows 10.

The error is:

`Failed to find target with hash string 'android-28' in: C:\Users\<username>\AppData\Local\Android\Sdk`

This is part of the log that seems related to the problem:

    Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\yossi\AppData\Local\Android\Sdk\licenses
    License for package Android SDK Build-Tools 28.0.3 accepted.
    Preparing "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)".
    "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" ready.
    Installing Android SDK Build-Tools 28.0.3 in C:\Users\yossi\AppData\Local\Android\Sdk\build-tools\28.0.3
    "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" complete.
    "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" finished.
    Checking the license for package Android SDK Platform 28 in C:\Users\yossi\AppData\Local\Android\Sdk\licenses
    License for package Android SDK Platform 28 accepted.
    Preparing "Install Android SDK Platform 28 (revision: 6)".
    "Install Android SDK Platform 28 (revision: 6)" ready.
    Installing Android SDK Platform 28 in C:\Users\yossi\AppData\Local\Android\Sdk\platforms\android-28
    "Install Android SDK Platform 28 (revision: 6)" complete.
    "Install Android SDK Platform 28 (revision: 6)" finished.
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    A problem occurred configuring project ':app'.
    > Failed to find target with hash string 'android-28' in: C:\Users\yossi\AppData\Local\Android\Sdk

I have the following defined as an env. variable:

    ANDROID_HOME=C:\Users\yossi\AppData\Local\Android\Sdk

I also tried to define it (following https://github.com/facebook/react-native/issues/8547#issuecomment-243929377) as:

    ANDROID_HOME=C:\\Users\\yossi\\AppData\\Local\\Android\\Sdk

and added another env. variable called `sdk-dir`, based on the same comment. Didn't help.

In this folder (C:\Users\yossi\AppData\Local\Android\Sdk) I have both `platform-tools` and `platforms`, and under `platforms` I have `android-28`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPlatform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions