React Native 运行报错 ---- SDK location not found

左手的ㄟ右手 2021-09-22 12:28 434阅读 0赞

React Native 环境搭建完成,创建项目后,

运行报错:

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ‘:app’.

SDK location not found. Define location with sdk.dir in the local.properties f
ile or with an ANDROID_HOME environment variable.
* 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: 13.533 secs
Could not install the app on the device, read the error above for details.
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/getting-started.html

两种解决方法:

(一) 添加系统环境变量 ANDROID_HOME 指向 Android SDK 的安装目录

以win7设置环境变量为例

20180602170614929

(二)在react-native 项目 android文件夹下新建 local.properties 文件 内容如下 (或者从已有的android项目中直接copy过来)

  1. sdk.dir=D\\:\\\\Android\\\\sdk

2018060217152045

发表评论

表情:
评论列表 (有 0 条评论,434人围观)

还没有评论,来说两句吧...

相关阅读