React-native: Failed to find target with hash string 'android-23'

Created on 20 Jan 2016  路  10Comments  路  Source: facebook/react-native

Hi,

I have already installed API 23

2016-01-20 22_09_46-

Created my environment as per instructions for React Native Android on Windows but when running

react-native run-android I get the following

failed to find target with hash string 'android-23' in: C:\Users\matija\AppData\Local\Android\android-sdk\platform-tools

2016-01-20 22_12_06-platforms

I've also updated build.gradle to use API 23.

Any help to would be great.

Help Wanted Windows Locked

Most helpful comment

Managed to solve this :godmode:

You need to point ANDROID_HOME to the parent directory of platforms and platform-tools so in my case this is:

C:\Users\matija\AppData\Local\Android\android-sdk

2016-01-23 21_24_15-this pc

Everything works fine and on a VS Emulator as all my Ionic apps.

All 10 comments

Hey matijagrcic, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

Hi, i solved the problem.
move 'android-23' folder into : C:\Users\matija\AppData\Local\Android\android-sdk\platform-tools

re start terminal and have fun :)

@SeyfertCode Tried that already, same error.

Managed to solve this :godmode:

You need to point ANDROID_HOME to the parent directory of platforms and platform-tools so in my case this is:

C:\Users\matija\AppData\Local\Android\android-sdk

2016-01-23 21_24_15-this pc

Everything works fine and on a VS Emulator as all my Ionic apps.

To document for further Windows users.

If you get:

Unable to download JS bundle.

Be sure that you can access:

http://localhost:8081/index.android.bundle?platform=android&dev=true

Fiddler works like a charm with VS Emulator so you instantly know what's the problem.

2016-01-23 21_51_23-react native android failed to load js bundle - stack overflow

2016-01-23 22_12_34-vs emulator 5 1_ marshmallow 6 0 0 xxhdpi phone

PRs are welcome to improve the docs on Windows. None of the core Team uses Windows, so we rely on the community entirely to help with Windows support :)

@satya164 Sure, will try to improve it by submitting some PRs. Probably not before next weekend.

Seems like this issue has been resolved, closing it.

For Linux users.
export ANDROID_HOME=/homer/${USER}/pathtosdk

You might want to put this in your bash_rc or most preferebly /etc/environment or .profile

I recommend to make sure next to items

  1. make sure to set jdk environment variable
  2. make sure to set "ANDROID_HOME"
  3. make sure to install Android SDK build-tools
  4. don't forget to run a AVD and then run "react-native run-android"

I got the same problem. I assured my environment variable. but it was wrong.
I installed visual studio for opencv. but it is a cause. after finished to be install, i got the same JDK environment variable. like that
C:\ProgramData\Oracle\Java\javapath
D:\Program Files\Java\jdk1.8.0_101\bin

Was this page helpful?
0 / 5 - 0 ratings