1.问题描述:
下载了一个rn的项目,运行react-native run-android出现了如下错误:
错误: 找不到或无法加载主类 org.gradle.wrapper.GradleWrapperMain
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/android-setup.html
2.问题原因:
缺少gradle--->wrapper这个文件夹
3.解决方案:
在查找了相关资料后,定位到了Stack Overflow上的一个解决方案,要有正确的文件才对,我直接从之前的项目中复制了一个gradle进去就可以了。正确的文件如图: