React Native:target has has hash string’android-X’not found

前端之家收集整理的这篇文章主要介绍了React Native:target has has hash string’android-X’not found前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图开发我的第一个 react-native Android应用程序。当我跑
  1. sudo react-native run-android

我得到以下错误

  1. JS server already running.
  2. Building and installing the app on the device (cd android && ./gradlew installDebug)...
  3.  
  4. FAILURE: Build Failed with an exception.
  5.  
  6. * What went wrong:
  7. A problem occurred configuring project ':app'.
  8. > Failed to find target with hash string 'android-23' in: /usr/local/Cellar/android-sdk
  9.  
  10. * Try:
  11. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  12.  
  13. BUILD Failed
  14.  
  15. Total time: 4.981 secs
  16. Could not install the app on the device,see the error above.

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

我的android / app / build.gradle说

  1. compileSdkVersion 23
  2. buildToolsVersion "23.0.0"
  3.  
  4. defaultConfig {
  5. applicationId "com.awesomeandroid"
  6. minSdkVersion 16
  7. targetSdkVersion 23
  8. versionCode 1
  9. versionName "1.0"
  10. ndk {
  11. abiFilters "armeabi-v7a","x86"
  12. }
  13. }

当我尝试$ ANDROID_HOME,它说-bash:/usr/local/Cellar/android-sdk/24.3.3:是一个目录。

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

我缺少什么?

您需要将ANDROID_HOME指向平台和平台工具的父目录,以便/usr/local/Cellar / android-sdk

猜你在找的React相关文章