error Android project not found. Are you sure this is a React Native project?

Viewed 5576

after serval days with react native and android running, I added some external libraries, and all was well.

After re-start of the computer, I got back to the root of the react native project and typed

npx react-native run-android

And got back the error msg

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. Run CLI with --verbose flag for more details.

my Android project is in standard location : MyReactProject\android.

Any ideas what happed or how to fix this?

5 Answers

I have found a solution that works, but it still don't know what went wrong. probably from installing the new packages.

  1. Open the Root Directory of my React Native Project
  2. go to \android\app\build\intermediates\signing_config\debug\out
  3. Delete the file signing-config.json
  4. go back to Root Directory
  5. type npx react-native run-android

the solution is based on this site, hope this will help others.

You should check your manifest I did not have the tag closed

Just found the solution. You just need to go to node_modules -> glob -> common.js

Find options.allowWindowsEscape and set it to false

It worked for me and it also took 3 hours to find the solution. Hope it will work for you as well.

Make sure you have "android" and "ios" folders in your project root directory exactly like below pictures shows. If you don't have these folders then create them.

npm i react-native-eject
npm i @react-native-community/cli


react-native eject
react-native upgrade

enter image description here

So Basically the Problem Could Be That You May be starting expo CLI quickstart Project in "React native CLI Quickstart" . There are two ways :- https://reactnative.dev/docs/environment-setup

the problem can be solved by :- 1)npm install -g expo-cli 2) expo init AwesomeProject

cd npm start # you can also use: expo start

Related