[I have created the project with npx react-native init
, started a metro server in react native using npm start and opened the VM in the android folder directory
]1
Where I got my information from: https://www.mongodb.com/docs/realm/sdk/react-native/install/#resolve-cocoapods-dependencies
I have been searching all day for an answer but nothing helped. I've tried using npm run eject, expo run:android, and even made a completely new project and copy pasted the android folder from it.
apparently, it doesn't even work in a completely new project.
i'm using ionic and i try to run my app in android studio. On Ios everything is working fine but android studio is always saying please add configuration. I actually have no idea how to add a configuration. Also my project contains three packages. I'm building my project with the following commands:
ionic build
npx cap sync
npx cap open android
Also android studio cannot resolve some libraries.
Please find attached a screenshot of the errors i have mentioned above:
thank you
I had this same issue, and I think it was a few problems compounded. It looks like you shouldn't have to add configurations manually, so if the "app" configuration doesn't appear automatically then something is wrong. I ran
ionic cap build android
which built everything and launched android studio. If that doesn't fix it, you might be missing some sdks. Try running this command from your android folder.
./gradlew assembleDebug
Mine complained about missing a specific version of the android sdk which I had to install with the android studio sdk manager. Then I relaunched android studio, and the "app" configuration was there.
I've created a new React Native app with react-native init ProjectName and tried to run it within IntelliJ. For this I've created a new run configuration:
But after run this configuration, only react-native start is executed and not the actual start of the app (react-native run-android). Within a shell it's working, but not with IntelliJ and therefore debugging within IntelliJ is not readily possible.
I'm using the latest React Native version 0.50.1 and IntelliJ 2017.2.5.
Do you know such a problem and do you know how to fix it? For existing applications, it still worked, but not for new ones. After npm install it seems to be buggy also with existing projects.
Known issue, tracked as WEB-29569: the packager messages format has changed in react-native 0.50.*, and WebStorm can't parse the output and start the run command.
As a workaround, you can try downgrading react-native to 0.49.
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 creation. Basically, when creating the project with npm, I get some starting files (App.js etc.) and a node_modules folder. I've got it up and running with expo, which created the .expo folder as well.
However, when I go to react's official documentation or look into plugins/addons on git they talk several times about an android and an iOS folder in the project root. But they are nowhere to be seen. I then got some hints that I could install and run react-native-upgrade-git, which allegedly would generate these missing folders. But that didn't work either.
So what have I missed? Where are those folders located?
Edit: Here is a screen dump from a Youtube tutorial showing the project structure I'm looking for:
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
You can get to that project structure by running:
npm run eject
However, it removes the app from the Expo framework, which adds a lot of nice benefits and abstraction from the Android/iOS code.
i think if you want to develop app with ReactNative you start follow this : Getting Started use React Native.
If you create project with ReactNative just write on your terminal like:
react-native init YourProjectName
cd YourProjectName
react-native run-ios //for iOS
I hope my answer helping you to create project with ReactNative. thanks..
Check this Expo document Adding custom native code
In general,
to generate ios folder: expo run:ios
to generate android folder: expo run:android
Try this to generate the Android and iOS folder
react-native eject
react-native link
To add to Funk Soul Ninja's answer after following his directions (thank you! :) ), for those who started with an Expo project:
expo run:ios
did the trick for me.
The command creates the ios folder that contains the project that can be edited and built in Xcode.
I did not do this step, but I believe expo run:android does exactly the analogous thing for Android; but I would suggest checking out Expo documentation on adding custom native code.
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
Delete folders android and ios
npm i react-native-eject
react-native eject
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.
run this in the root directory
expo eject
in the begining install react native, after run expo init YourProject , choose minimal (Typescript) . after that go to YourProject directory and do not run npm start. but run npm run android. hope this help
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:
If you created the project with Expo you will have the Expo folder instead of ios and android folders
If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues:
npm uninstall -g react-native-cli #react-native-community/cli
then create a new project again:
npx react-native init DemoApp
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"
I'm having some issues with the new phonegap installation, using nodejs. I've managed to get everything working, set the path to ant, android sdk, java jdk etc., everything works perfectly.
With the usage of the following commands I've managed to create a new project:
cordova create hello com.example.hello HelloWorld
However, when I've examined the project, it was empty:
So I went into the "hello" folder and added an Android platform in the following manner:
cordova platform add android
and then I've build it:
cordova build android
So, after that, there were some android specific folders, as shown below:
Is this how the structure is suppose to look like? I'm having REAL problems importing this into Android Studio. However, I managed to import the project into eclipse, but now I have two projects, first is named "HelloWorld" and the other "HelloWorldCordovaLib". This is a bit confusing. While it works, why are there two projects? Am I doing something wrong?
Moreover, when I import this project into android studio, I get a bunch of errors (whereas the same project works in eclipse): Errors with the structure
This is seems very, very confusing. I have yet to understand why Phonegap is suddenly so hard to install. I hope I'm missing something. Any kind of feedback is welcome. Thanks.
Android Studio, amazingly, can't import Android projects that don't have the Gradle project structure. Until Cordova starts generating Gradle files, or Android Studio completes the importer's types of projects it'll support, you have to export the project from Eclipse before you can import it in to Android Studio.
It's perfectly valid to have two Projects in one Cordova application. Usually, it's because your app references the Cordova project as a sort of "sub-project" (not the right term, but I'm not sure what Android calls it).
The structure is correct.
when giving the command cordova platform add android you are actually adding a folder named android inside platform folder. For android development you have to work on the files inside platforms/android.
Read more here Phonegap - Command line interface