React Native android 构建失败.未找到 SDK 位置

React Native android 构建失败.未找到 SDK 位置

问题描述:

我开始运行android时出错

I have error when i start running android

What went wrong:
A problem occurred evaluating project ':app'.  
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

  • 转到你的 react-native 项目的 android/ 目录
  • 使用以下行创建一个名为 local.properties 的文件:
    • Go to the android/ directory of your react-native project
    • Create a file called local.properties with this line:
sdk.dir = /Users/USERNAME/Library/Android/sdk

其中 USERNAME 是您的 macOS 用户名

Where USERNAME is your macOS username