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

本秂侑毒 提交于 2019-11-28 19:09:33

You need to point ANDROID_HOME to the parent directory of platforms and platform-tools so /usr/local/Cellar/android-sdk

kzzzf

Your $ANDROID_HOME should point to /usr/local/android-sdk and it would be the parent directory of platforms and platform-tools

Gradle will try to locate tools dir in the following location: $ANDROID_HOME/platform/android-23 so verify that you have your tools installed there if the android-23 folder is not present inside $ANDROID_HOME/platform/ , please install Android 6.0 (API23)

What I did was to change the target my application was compiled against. To do this edit the file android/app/build.gradle on your project and modify the following:

compileSdkVersion 24
buildToolsVersion "24.0.2"

This should match whatever you have installed without requiring to download another API version.

please try to install android 6.0 (Marshmallow) api level 23

i just did and works for me

I followed the React Native Getting Started instructions and my ANDROID_HOME and PATH was right but I was still getting this error.

The solution was to install "Android 6.0 (Marshmallow)" from this screen (without clicking "Show Package Details"):

😂 i solved this problem,and just replaced export ANDROID_HOME=/usr/local/Cellar/android-sdk by export ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1_1

android sdk

None of the above solutions worked for me, working on a react native app generated with Ignite. Finally, I opened the project up in Android Studio, instead of doing everything via the command line, and a bunch of errors popped up. Fixing the errors one by one within Android Studio solved this problem for me.

You do need the correct path set for ANDROID_HOME for this to work. I installed android sdk with brew, so my path was /usr/local/opt/android-sdk.

What helped me - I've just removed all installed SDK Platforms and SDK tools using Android SDK Tool

And Run build again and Android Studio found what it should install and where. If you will follow this instruction - make sure you are running Android Studio with enough permissions to install everything.

Have fun with this issue! Hope it will help you

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!