简体   繁体   English

在 Init 项目之后的 React Native 项目中出现错误“无法在 null 对象上获取属性‘依赖项’”

[英]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 来临时解决问题,如下所示

  1. Search the line json = new JsonSlurper().parseText(reactNativeConfigOutput) in node_modules@react-native-community\cli-platform-android\native_modules.gradle filenode_modules@react-native-community\cli-platform-android\native_modules.gradle文件中搜索行json = new JsonSlurper().parseText(reactNativeConfigOutput)
  2. Add 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.

相关问题 在Windows上初始化新项目时反应本机错误 - React native error on init new project on windows 在新的 Android Studio 项目上获取 `Error:Cannot get property ':lib' on null object` - Getting `Error:Cannot get property ':lib' on null object` on a new Android Studio project TypeError:在将自定义 fonts 与本机项目链接时无法读取 null 的属性“UIAppFonts” - TypeError: Cannot read property 'UIAppFonts' of null while linking custom fonts with react native project 使用init命令创建React Native项目 - Create react native project with init command React-native 在运行 android 项目时抛出错误(null 不是对象) - React-native when running an android project throws an error (null is not an object) 无法解决React Native项目中的依赖关系 - Failed to resolve dependencies in the react native project react-native init 与 Expo 用于新的 React Native 项目? - react-native init versus Expo for new React Native project? 未定义不是React Native项目中的对象 - Undefined is not an object in React Native project 反应本地推送通知错误:无法在空对象上调用方法get() - react native Push Notification error: Cannot invoke method get() on null object 在准系统反应本机项目中安装 expo 后,我收到此错误 - After installing expo in a bare-bone react native project, I get this error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM