React Native:未找到哈希字符串“android-X”的目标

2024-05-05

我正在尝试开发我的第一个反应本机 https://facebook.github.io/react-native/ Android应用程序。当我跑步时

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.

I have 24.3.3 under /usr/local/Cellar/android-sdk安装了所有 API-23 软件包

My android/app/build.gradle says

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.

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

我错过了什么吗?


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

Gradle 将尝试在以下位置找到工具目录:$ANDROID_HOME/platform/android-23因此,请验证您是否已安装工具,如果 $ANDROID_HOME/platform/ 中不存在 android-23 文件夹,请安装 Android 6.0 (API23)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

React Native:未找到哈希字符串“android-X”的目标 的相关文章

随机推荐