I had an issue in my React-Native project which was working fine earlier but suddenly it stopped working. Whenever I used the command:
react-native run-andro
I faced this problem today, and none of the solutions worked for me, so I found another one.
Badly Formatted AndroidManifest.xml will cause this problem, perhaps you set the splash screen like me today, and didn't formatted AndroidManifest in the correct way
Make sure to start the project using command (non-expo):
react-native init <your-project-name>
If existing folder, then follow:
react-native eject
In the latest version of react-native this suggestion comes when you try to issue the command:
react-native eject
Scanning folders for symlinks in D:\ProjectRoot\ReactNativeProjects\AwesomeProject\node_modules (48ms) App
name
must be defined in theapp.json
config file to define the project name. It must not contain any spaces or dashes.
Now when you issue the following command:
D:\ProjectRoot\ReactNativeProjects\AwesomeProject>react-native upgrade
The following shows up:
Scanning folders for symlinks in D:\ProjectRoot\ReactNativeProjects\AwesomeProject\node_modules (56ms) You should consider using the new upgrade tool based on Git. It makes upgrades easier by resolving most conflicts automatically. To use it: - Go back to the old version of React Native - Run "npm install -g react-native-git-upgrade" - Run "react-native-git-upgrade" See https://facebook.github.io/react-native/docs/upgrading.html react-native version in "package.json" doesn't match the installed version in "node_modules". Try running "npm install" to fix this. Aborting.
In the Facebook react-native commands suggestions, there is a clear solution.
These commands check the current version and whether there is update needed or not.
One more solution:
react-native: Command run-android unrecognized. Maybe caused by npm install
Please also see:
Solution to "Expo : cannot find a module LogReporter"
I'm using Android Studio (non-expo) and this works for me
react-native init <your-project-name>
You have to run your cmd with admin priviliges. That solved the same issue for me. Didnt do "eject" or anything else.
If you started your project by following
npm install -g create-react-native-app
create-react-native-app MyReactNative
npm install -g react-native-cli
npm start
after this, you can face problem mention above in question So the solution is :
npm run eject
When I ran react-native eject
, I got this error:
Both the iOS and Android folders already exist! Please delete `ios` and/or `android` before ejecting.
MyProject/android
folder.Run react-native eject
This generated the android
folder
Then run react-native run-android
to build android