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

前端 未结 30 1177
孤街浪徒
孤街浪徒 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:26

    If you have created your project with the expo command, like expo init projectname, then afterwards you have to eject your project:

    expo eject
    

    If you have created you project by react-native init projectName then you have to use

    react-native eject
    
    0 讨论(0)
  • 2020-12-12 17:26

    Delete react native android build folder and then retry command npx react-native run-android

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

    Open your React Native Project Root Directory and locate android -> app -> build -> intermediates -> signing_config -> debug -> out -> signing-config.json . delete signing-config.json this file try again

    Or

    1)Sometimes if we have older version of react native and some of newly installed packages dose not support older version. Then you have to update the react native project using react-native upgrade command.

    1. After done updating current project to new version this error should resolved.
    0 讨论(0)
  • 2020-12-12 17:33

    Running Terminal as Administrator in Windows did the trick for me... Other solutions did not work.

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

    Here, app.json does not have name, but it has expo related config. So just add name and display name fields in app.json.

    app.json (first two lines) :

    {
    "name": "AwesomeProject",
    "displayName": "Awesome Project",
    "expo": {
        "name": "AwesomeProject",
        "description": "A very interesting project.",
        "slug": "AwesomeProject",
        "privacy": "public",
        "sdkVersion": "30.0.0",
        "platforms": ["ios", "android"],
        "ios": {
          "supportsTablet": true
        },
        "android": {
          "package": "com.project.first"
        },
        "version": "1.0.0",
        "orientation": "portrait",
        "icon": "./assets/images/icon.png",
        "splash": {
          "image": "./assets/images/splash.png",
          "resizeMode": "contain",
          "backgroundColor": "#ffffff"
        },
        "updates": {
          "fallbackToCacheTimeout": 0
        },
        "assetBundlePatterns": [
          "**/*"
        ]
      }
    }
    

    After this, just run :

    $ react-native eject

    info Generating the iOS folder.

    info Generating the Android folder.

    No need to do react-native upgrade.

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

    I had the same error in a project (created with React Native CLI):

    turns out I had a syntax error in my android manifest file (android/app/src/main/AndroidManifest.xml).

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