[英]Error “Cannot get property 'dependencies' on null object” in React Native Project just after Init project
I created a new React-Native project using react-native init AppName and when I tried to run in Android it throws Cannot get property 'dependencies' on null object in line @react-native-community\cli-platform-android\native_modules.gradle' line: 183 I am not sure why I am getting this exception. I created a new React-Native project using react-native init AppName and when I tried to run in Android it throws Cannot get property 'dependencies' on null object in line @react-native-community\cli-platform-android\native_modules.gradle' line: 183我不确定为什么会出现此异常。 I didn't even do any changes in the project
我什至没有对项目进行任何更改
Following is the command I use以下是我使用的命令
react-native init Example
cd Example
npm i
react-native run-android
Version of react-native react-native版本
react-native-cli: 2.0.1
react-native: 0.61.3
Version of npm - 6.11.2
npm - 6.11.2
版本
Installing the @react-native-community/cli-platform-android using the below command solved my issue使用以下命令安装 @react-native-community/cli-platform-android 解决了我的问题
npm i @react-native-community/cli-platform-android
If the above doesnot resolve the issue, I temporarily fix the issue by updating the native_modules.gradle like below如果上述方法不能解决问题,我通过更新 native_modules.gradle 来临时解决问题,如下所示
json = new JsonSlurper().parseText(reactNativeConfigOutput)
in node_modules@react-native-community\cli-platform-android\native_modules.gradle filejson = new JsonSlurper().parseText(reactNativeConfigOutput)
reactNativeConfigOutput = reactNativeConfigOutput.substring(4);
reactNativeConfigOutput = reactNativeConfigOutput.substring(4);
above that line. Above fix the issue, but I think this is a temporary fix以上解决了问题,但我认为这是一个临时修复
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.