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

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

提交回复
热议问题