Fix: React Native Android Project Not Found

When I was trying to create React Native project using react-native cli. I was getting below error:

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.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The command I was using

npx react-native init test

After running the command npx react-native init test , I was trying to run my android app by using below command

cd test & npx react-native run-android

Then I got below error:

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.

If you are also facing same type of error then no worries , we will provide fix for this.

Why Android Project Not Found Error Occurred in React Native?

Android project not found error occurred in React Native when glob@7.2.2 version was released

How to fix Android Project Not Found Issue in React Native?

Fix 1: Using Reinstall node_module

To fix the Android Project Not Found Issue in React Native, first you have to delete node_modules then add "resolutions": { "glob": "7.2.0" } to package.json file . Finally Reinstall the node_modules with npm install.

Steps to Fix Android Project Not Found Issue in React Native:

Step 1: Delete node_module

Step 2: Add below to package.json file:

"resolutions": 
{ 
"glob": "7.2.0" 
}

Step 3: Again reinstall node_module with npm install

Fix 2: Using glob

If above fix not work then install the glob with npm i glob@7.2.0.

Fix 3: Without Reinstalling node_module

If you want to fix Android Project Not Found Issue in React Native without re installing node_module then go into the node_modules folder, find glob, and open the common.js file.

After that in line 114 you will find options.allowWindowsEscape = true, change it to options.allowWindowsEscape = false and it will work perfectly!

Steps to fix Android Project Not Found Issue in React Native without re installing node_module :

  1. Go to node_modules folder
  2. After going to node_modules folder, find glob
  3. In glob, open common.js file
  4. After opening common.js file, go to line number 114
  5. In line number 114, you will find options.allowWindowsEscape = true
  6. Now replace options.allowWindowsEscape = true to options.allowWindowsEscape = false
  7. Your issue will be resolved.

Conclusion

Android project not found error occurred in React Native when glob@7.2.2 version was released.

There are 3 possible fixes for this isuue, with reinstalling node_module, using glob or without reinstalling node_module.

Hope one of above 3 fixes resolved your issue.

Read More:

Steam Summer Sale is Live now! To Check the Steam Summer Sale Clues Answers, Click Below: