Unable to build react-native app on Android device :failed to find target with hash string 'android-23'

  • Find android sdk location.(e.g /Users/username/Library/Android/sdk or /usr/local/opt/android-sdk or /Applications/ADT/sdk)

  • Open shell config file that it depends on what shell you're using. ~/.bash_profile or ~/.bashrc or ~/.zshrc.

  • Edit or add the following lines to shell config file:

$ export ANDROID_HOME=`YOUR_ANDROID_SDK_PATH` 
$ export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
  • Restart the terminal and run again.

Update

Check in official website

References

  • Setting ANDROID_HOME enviromental variable on Mac OS X

  • React Native : target with hash string 'android-X' not found