React Native:找不到散列字符串'android-X'的目标

Jas*_*bas 34 android android-sdk-tools react-native

我正在尝试开发我的第一个react-native Android应用程序.我跑的时候

sudo react-native run-android
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> failed to find target with hash string 'android-23' in: /usr/local/Cellar/android-sdk

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.981 secs
Could not install the app on the device, see the error above.
Run Code Online (Sandbox Code Playgroud)

24.3.3/usr/local/Cellar/android-sdk安装了所有的API-23封装

在此输入图像描述

android/app/build.gradle

compileSdkVersion 23
buildToolsVersion "23.0.0"

defaultConfig {
    applicationId "com.awesomeandroid"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试时$ANDROID_HOME,它说-bash: /usr/local/Cellar/android-sdk/24.3.3: is a directory.

我还添加了local.propertiesandroid/app/,并添加sdk.dir=/usr/local/Cellar/android-sdk/24.3.3

我错过了什么吗?

kzz*_*zzf 12

你的$ ANDROID_HOME应该指向/usr/local/android-sdk它,它将是平台和平台工具的父目录

Gradle将尝试在以下位置找到工具目录:$ANDROID_HOME/platform/android-23如果$ ANDROID_HOME/platform /中没有android-23文件夹,请确认您已安装工具,请安装Android 6.0(API23)


Mat*_*cic 10

你需要将ANDROID_HOME指向平台平台工具的父目录,这样/ usr/local/Cellar/android-sdk