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.

react-native:SDK location not found. Define location with sdk.dir in the local.properties file ..._第1张图片

错误原因:

这个提示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

react-native:SDK location not found. Define location with sdk.dir in the local.properties file ..._第2张图片

你可能感兴趣的:(Android开发,React,Native开发)