React Native第一次运行报错 error Command failed: gradlew.bat app:installDebug

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

按照官网上的步骤安装并运行第一个RN项目,没想到出现了下面的错误。

BUILD FAILED in 4m 4s
1 actionable task: 1 executed
error 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
error Command failed: gradlew.bat app:installDebug

首先确定我的设备已经连上了

C:\Users\admin>adb devices
List of devices attached
D5F021***08219        device

后来的解决办法是:
在RN项目下运行执行了yarn add react-native-cli命令
然后把Android项目中local.properties文件拷贝到RN项目Android文件夹中
local.properties内容是sdk目录

sdk.dir=D\:\\AS\\sdk

猜你喜欢

转载自blog.csdn.net/sjdjdjdjahd/article/details/88714519