在搭建react-native开发环境的环境的时候,到了npx react-native run-android最后一步的时候,竟然出现以下错误:
error Android project not found. Are you sure this is a React Native project? If your Android files are located in a non-standard location (e.g. not inside 'android' folder), consider setting `project.android.sourceDir` option to point to a new location.
info Run CLI with --verbose flag for more details.
找了很多方法没找到解决办法,最后用React Native Android Project Not Found - Stack Overflow找到了解决方法。不过我没有在package.json(不知道是不是在工程目录下的那个package.json)添加
"resolutions": {
"glob": "7.2.0" }
因为在工程目录下的那个package.json添加这段代码之后执行npm install报错了。后来安装glob:npm i glob@7.2.0,在重新安装npm install,最后再执行npx react-native run-android就正常运行了。