React native: Android project not found. Maybe run react-native android first?

前端 未结 30 1175
孤街浪徒
孤街浪徒 2020-12-12 16:43

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         


        
相关标签:
30条回答
  • 2020-12-12 17:22

    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

    0 讨论(0)
  • 2020-12-12 17:24

    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 the app.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"

    0 讨论(0)
  • 2020-12-12 17:24

    I'm using Android Studio (non-expo) and this works for me

    react-native init <your-project-name>
    
    0 讨论(0)
  • 2020-12-12 17:24

    You have to run your cmd with admin priviliges. That solved the same issue for me. Didnt do "eject" or anything else.

    0 讨论(0)
  • 2020-12-12 17:25

    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
    
    0 讨论(0)
  • 2020-12-12 17:26

    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.
    
    • Delete the MyProject/android folder.
    • Run react-native eject This generated the android folder

    • Then run react-native run-android to build android

    0 讨论(0)
提交回复
热议问题