Joe 89
Joe 89

Reputation: 910

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 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-cli: 2.0.1
react-native: 0.61.3

Version of npm - 6.11.2

Upvotes: 0

Views: 1440

Answers (1)

Joe 89
Joe 89

Reputation: 910

Installing the @react-native-community/cli-platform-android using the below command solved my issue

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

  1. Search the line json = new JsonSlurper().parseText(reactNativeConfigOutput) in node_modules@react-native-community\cli-platform-android\native_modules.gradle file
  2. Add reactNativeConfigOutput = reactNativeConfigOutput.substring(4); above that line.

enter image description here

Above fix the issue, but I think this is a temporary fix

Upvotes: 3

Related Questions