react-native:SDK location not found. Define location with sdk.dir in the local.properties file ...

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 file 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.

错误原因:

这个提示Android SDK没有找到,可以通过local.properties配置sdk.dir,也可以设置设置ANDROID_HOME环境bi变量来设置SDK位置;

方案一:

在react-native创建的项目目录下的Android目录下新建一个local.properties文件,

编辑内容:

sdk.dir = D:/ProgramFile/Android/androidsdk

 方案二:

在环境变量中添加名ANDROID_HOME的变量,值为SDK路径

"我的电脑"右键“属性”->高级系统设置->环境变量 -> 新建ANDROID_HOME

猜你喜欢

转载自blog.csdn.net/niuba123456/article/details/81836393