简体   繁体   English

在React native中找不到Android sdk

[英]Android sdk not found in React native

I have done all the set up for Android and iOS in React Native from below link in my mac mashine. 我已经在我的mac mashine下面的链接中完成了React Native中针对Android和iOS的所有设置。

https://facebook.github.io/react-native/releases/0.23/docs/android-setup.html

Project created successfully. 项目创建成功。 But when I tried to run the Android project using following command in my terminal: 但是当我尝试在终端中使用以下命令运行Android项目时:

react-native run-android

I am getting the below error 我收到以下错误

FAILURE: Build failed with an exception.
  • What went wrong: A problem occurred configuring project ':app'. 出了什么问题:配置项目':app'时出现问题。

    The SDK directory '/usr/local/opt/android-sdk' does not exist. SDK目录'/ usr / local / opt / android-sdk'不存在。

  • Try: Run with --stacktrace option to get the stack trace. 尝试:使用--stacktrace选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output. 使用--info或--debug选项运行以获取更多日志输出。

BUILD FAILED 建筑失败

Total time: 16.645 secs Could not install the app on the device, read the error above for details. 总时间:16.645秒无法在设备上安装应用程序,请阅读上述错误以获取详细信息。 Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/android-setup.html 确保运行Android模拟器或连接设备并设置Android开发环境: https//facebook.github.io/react-native/docs/android-setup.html

IO have copy the sdk firl to respectrive directory IO已将sdk firl复制到respectrive目录

'/usr/local/opt/android-sdk 

But didnot over ride from the error. 但是没有超越错误。

Please create a file named local.properties inside your project's android folder and add the below line to it and save it. 请在项目的android文件夹中创建一个名为local.properties的文件,并在其中添加以下行并保存。

sdk.dir={PATH OF YOUR ANDROID SDK}

After adding this file run again it will work properly. 添加此文件后再次运行它将正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM