Missing android,ios & app folders and index js files
I'm using react native v 0.1.10 in windows 7 OS
We can generate android and ios folder by using upgrade
Run react-native upgrade to generate /ios and /android folders again.
Run react-native link for any native dependency. (if needed)
Finally run
react-native run-ios
or
react-native run-android
Probably you created your project using create-react-native-app, which is an even more simplified toolchain.
You should probably eject if you need android/ios native configs or something.
Please take a look at this doc: https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md
Try this to generate the Android and iOS folder without change version
react-native eject
react-native link
Install a new file using powershell instead of cmd.
Run following commands
1. npx react-native eject
After running above command you can see output in console as follows
info Generating the iOS folder.
info Generating the Android folder.
Next below command
2. npx react-native run-android
Try update ur nodejs and npm to the latest version then run everything again starting from init
npm run eject
next we will get some couple of questions,
? how would you like to eject from create-react-native-app
React-Native : I'd like a regular react native project
? What should your app appear as on a users's home screen? _Your wish____
? What should your Android Studio and Xcode projects be called? rncourse
After Ejected Successfully the project structure will change, added folders android and ios.
happy coding
Related
npm start
Select a - for android
However, with this, you only have the app running temporarily and have to do it repeatedly to launch it.
Is there a way to permanently install an app by Build -> Install like on Android Studio?
Thank you all in advance.
Well if you wish to permanently install the app on your phone, you will have to generate a production build (.apk file) and install it on your phone.
npx react-native run-android --variant=release
Read this for more clearity regarding builds.
It's unclear if you want to install it to your physical device or not.
In android studio you can press "Build" in the menu and then select build variants, change "app" to release.
Similarly in xcode, you can select build configuration to be on release.
Then you just build the project and you will have a release version of the app on your phone.
I'm trying to create a slider in my react native Android App, and relatively new to React Native. The React Native documentation says their Slider component is deprecated (https://reactnative.dev/docs/slider.html) and directs us to use #react-native-community/slider instead (https://github.com/react-native-community/react-native-slider/blob/master/README.md).
I installed the library in my project directory using npm install #react-native-community/slider --save.
The install succeeded and my versions in my package.json are as follows:
"dependencies": {
"#react-native-community/slider": "^3.0.3",
"react": "16.13.1",
"react-native": "0.63.0" },
I am including the Slider in my source file with import Slider from '#react-native-community/slider';, however when ever I try to actually create a slider in my code with the <Slider> ... </Slider> tags, I get the following compile error:
ERROR Invariant Violation: requireNativeComponent: "RNCSlider" was not found in the UIManager.
I've been banging my head against the wall and can't figure out how to clear the error.
I am on Windows 10 x64 developing for Android.
Thanks in advance!
I've also faced this issue and if you've followed the setup instructions word by word, the solution should be:
Stop the Metro Bundler.
Stop the app on the simulator/physical device.
Run react-native-start.
Run react-native run-android or run the app on your physical device.
Done!
This is what fixed it for me for development on iOS. Hope this can be of help to you on Android as well!
The solution for me was to just run "npx react-native run-android" in my project directory rather than trying to use "npx react-native start". I'm not sure why this works, but it launches the metro server in another console window (using cli.js) rather than in powershell itself. This seems to solve the problem.
Historically I had been launching the app directly from my emulated phone OS, but this didn't work even if I had the metro server running in powershell.
run command in vs code terminal
cd ios
pod install
cd ..
react-native run-ios
or
react-native android
I tried #Californium's method to stop the Metro Bundler, Simulator, and re-run everything, but that didn't work for me. I also tried to link Slider, but that even didn't work for me.
react-native link #react-native-community/slider
I think You need to just
Import Slider form 'react-native'
This worked for me.
You can try all the steps, provided and if those didn't work. Use the slider from react-native.
When I run react-native run-android from VS code it runs perfectly on my android phone. But when I try to generate build from the android studio it shows me version mismatch error. I have tried every solution from the internet but none of it resolves my issue. pleas help me out. this thing happened after I upgraded my react native project version from 0.57.3 to 0.58.3. I have even search in the whole project folder there is no such 0.57.3 found in any file or any filename or folder name. what is going wrong?
React Native Version mismatch.
Javascript Version: 0.57.3
ReactNative Version: 0.58.3
There is a chance to get this error when you run npm start somewhere else in other project but didn't shut it down when you run react-native run-android in current project. This make your current react-native app trying to read the js bundle of other project and cause react-native version mismatch.
Try run npm start in terminal and see if it load your js bundle properly.
after deleting index.android.bundle and then running this command react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ made that error gone. hence error is solved for now dont know if anything other comes up
I followed React Native Official Doc Step By Step from
https://facebook.github.io/react-native/docs/getting-started.html
and initialized a project and got the following files (except splash.js and style.js)
For learning React Native I was following a youtube video and in there the project folder contained some android and ios specific files.
But I ran the project by creating a simple splash screen and it's running on both android or ios file.
As a beginner I'm so confused. So How can i get those files.
For Example,
index.ios.js
Index.android.js
just double check that you follow this instructions https://facebook.github.io/react-native/docs/getting-started.html and not something else.
Now what i am doing is
1) npm install -g react-native-cli
2) react-native init AwesomeProject
3) cd AwesomeProject
4) react-native run-ios
you are using expo if you want native code try Building Projects with Native Code tab on https://facebook.github.io/react-native/docs/getting-started.html#getting-started
Can an iOS app (built entirely with React Native) be built/run from the command line? PhoneGap has a nice ios-sim utility for doing just that, but I haven't had any luck with it.
If you build the project once using Xcode, then you can close it, run npm start in your project root (to start the packager), fire up the Simulator (maybe using ios-sim). Since you built it once in Xcode, the app will be installed in the simulator so you can just run it and the whole CMD+R refresh process will work.
Fire up the server with:
$ npm start
Build/run the app in the ios simulator:
$ react-native run-ios