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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/write6/article/details/80549487

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设置环境变量为例

  


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

扫描二维码关注公众号,回复: 3834101 查看本文章

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

 

猜你喜欢

转载自blog.csdn.net/write6/article/details/80549487