React Native iOS and Android folders not present

前端 未结 10 973
旧巷少年郎
旧巷少年郎 2020-12-13 00:03

I\'m new to react native, and I\'ve been having some trouble understanding the folder structure of the app which should supposedly be present in the project folder on creati

相关标签:
10条回答
  • 2020-12-13 00:08

    This worked for me: Go to Setting and remove both entries "android" and "ios" from "Files:Exclude". Don't forget both environments - User and Workspace.

    Removing entries on Workspace:

    ... same for User:

    0 讨论(0)
  • 2020-12-13 00:09

    One of the points of Expo on top of React Native is that you don't go down to android or ios code. Expo deals with those folders for you, you don't need to interact with them. Is there a reason you need those folders? if so, you will have to eject. Here's the documentation to do so: Ejecting with ExpoKit

    0 讨论(0)
  • 2020-12-13 00:10

    Delete folders android and ios

    npm i react-native-eject
    react-native eject
    
    0 讨论(0)
  • 2020-12-13 00:14

    The simplest way I know

    1) Take your app name from your current app.json, let's say the name is "mynativeapp"

    2) make a new folder somewhere outside of your current project folder

    3) start in it:

    react-native init mynativeapp

    4) the command above will make android and ios folders internally compatible by name with your project

    5) copy android/ios folders into your project folder

    Now you can try to start your native project. I checked that for Android:

    react-native run-android

    enjoy!

    P.S. "react": "16.9.0", "react-native": "0.61.4"

    0 讨论(0)
  • 2020-12-13 00:15

    I had to run expo eject. The story behind why I didn't have the folders is had to downgrade my react-native application because of some broken dependencies and then I got build failures. So I deleted the ios and android folders then ran expo eject and got all the build issues fixed. Note that I used expo command line via a script in package json so that the versions would match the version my project was using.

    0 讨论(0)
  • 2020-12-13 00:17

    I think I am little late but follow this steps if you don't want to read any document.

    android and ios folder are not present when react native project is created with expo. so you have to detach expo from your project to create android and ios folder.

    first add required package name in app.json file

        ios: {
           bundleIdentifier: "com.yourcompany.yourappname",
        },
        android: {
           package: "com.yourcompany.yourappname",
        }
    

    then run below command in terminal

    exp detach
    

    after command is successfully executed you will find android and ios folder

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