React Native:找不到带有哈希字符串'android-X'的目标 [英] React Native : target with hash string 'android-X' not found

查看:100
本文介绍了React Native:找不到带有哈希字符串'android-X'的目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发我的第一个 react-native Android应用.当我运行

I am trying to develop my first react-native Android app. When I run

sudo react-native run-android

我收到以下错误

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.

我在/usr/local/Cellar/android-sdk下有24.3.3,并安装了所有API-23软件包

I have 24.3.3 under /usr/local/Cellar/android-sdk with all API-23 packages installed

我的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"
    }
}

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

When I try $ANDROID_HOME, it says -bash: /usr/local/Cellar/android-sdk/24.3.3: is a directory.

我还在android/app/下添加了local.properties并添加了sdk.dir=/usr/local/Cellar/android-sdk/24.3.3

I have also added local.properties under android/app/ and added sdk.dir=/usr/local/Cellar/android-sdk/24.3.3

我想念什么吗?

推荐答案

您需要将 ANDROID_HOME 指向平台 platform-tools ,因此/usr/local/Cellar/android-sdk

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

这篇关于React Native:找不到带有哈希字符串'android-X'的目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆