How to build react native app on windows - react-native

Is it possible to build app in React Native using Windows instead of linux ?
I am a really beginner. On the official website ReatNative we can read:
Assuming that you have Node installed, you can use npm to install the
create-react-native-app command line utility:
npm install -g create-react-native-app Then run the following commands
to create a new React Native project called "AwesomeProject":
create-react-native-app AwesomeProject
cd AwesomeProject npm start
But how to do that on windows ?
There is no information about that

Take a look at this page - Getting Started
Please note that you have to select Building Projects with Native Code Tab. Then you can select Windows and Android

On Windows you can only develop react native app for Android. Then if you want to build apps for iOS you need a IDE called Xcode. And Xcode is only available on mac OS. Other way to build apps for iOS is creating a mac OS virtual machine that runs on Windows. your pc / laptop must have enough computing power to run it. I think 8GB RAM, and SSD and a Intel i5 7x series would be enough.
For installing Node.js and other tools you need for your development on Windows you have to use the command prompt. That is what you was asking for. I hope it helps you. Let me know if you have success.
Take a look here
How to use the Windows command line
Getting Started with React Native Development on Windows

Related

Can I build both iOS and Android apps using react native on Ubuntu Linux?

So I just started out to learn react-native but I found out that to build both iOS and Android requires OS X. I use Ubuntu but I haven't heard or read from somewhere about Linux writing react-native applications.
You can't build iOS app without XCode. Maybe you can do this using virtual machine.

This release is not compliant with the Google Play 64-bit requirement (ExpoKit)

Warning in Google Play:
This release is not compliant with the Google Play 64-bit requirement
The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: 1.
From August 1, 2019 all releases must be compliant with the Google Play 64-bit requirement.
Include 64-bit and 32-bit native code in your app. Use the Android App Bundle publishing format to automatically ensure that each device architecture receives only the native code it needs. This avoids increasing the overall size of your app.
How to fix this problem?
What I have already tried is to add ndk.abiFilters in gradle
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
when I created apk, app started crashing immediately.
You have to upgrade your react native. For expo follow react native docs. For react native without expo You can use these commands:
sudo npm install -g react-native-git-upgrade
Then
react-native-git-upgrade

Creating Android and iOS app from react-native

I have created one react-native app using expo and atom editor. It's running fine in android device and iOS simulator but with the help of expo. What I want is to generate Apk(debug) so that I can directly run on device. How can I do it ? I followed this(Dmitry Mugtasimov's answer). should I run all those command inside project folder ? Also I don't find index.js file inside my project folder. Also if someone know how to run on iOS simulator by creating app like file(don't know what is that in Ios because from android background). Please help, thanks
Since you have used Expo to develop your react-native app you can build the android app by going to the project folder and running the bellow command in the terminal
expo build:android
The building process will take around 5-10 minutes. When your build is done, expo build:status will give you your .apk file url. If not, it will say your build is still in progress and to try again later.
Also to build the iOS app you can run,
expo build:ios
To build the iOS standalone app you will need to have an Apple Developer account, but for Android standalone app you don't need a Google Play Developer account.
For the above commands to work you need to have expo-cli installed, For this you can run the bellow command,
npm install -g expo-cli
More Info: https://docs.expo.io/versions/latest/distribution/building-standalone-apps/
If you don't have an Apple Developer Account. You can build the iOS
standalone simulator build using the command,
expo build:ios -t simulator
And then wait for build to finish then download and unpack YourAppName.tar.gz. Then, start the iOS simulator and run xcrun simctl install booted YourAppName.app to run the .ica file.
More info: Expo / React-Native, Is it there a way to test-run standalone iOS apps on a device/simulator?

Could not install the app on the device - react native on windows 10

Everytime I try to launch a react native project I got this error
Could not install the app on the device, read the error above for
details. Make sure you have an Android emulator running or a device
connected and have set up your Android development environment
I reinstalled nodejs, python and jdk using choco as suggested on official docs. Every single packages is installed as well as sdk 23.0.1
I can see my virtual device if I run adb devices USB debugging is activated and it's running android 6.
I setup ANDROID_HOME path in environment variables, I'm using same sdk path as you can see in the picture. I also setup another one for JAVA_HOME and Python.
My PATH looks like this:
I just don't understand what I'm supposed to do. I'm using a surface pro 4, Windows 10. I can run projects using expo. I literally tried everything, restart computer, start cmd using admin, create new virtual devices, uninstall everything and start from scratch, it just don't work.
You have pointed out two issues; first, make sure you have an android emulator running. To do that, you run adb devices and you say you can see you device.
The other issue is with the environment. To make sure your environment is setup properly for android, go to the root of your react-native project. Open the android project using android studio.
All errors with your environment will show up, use the automatic fixes provided by android studio. Clean the project in android studio. Close studio and go back to command line, run react-native run-android
Everything should work now.
When doing react-native start it will intentionally hang at "Loading dependency graph" (its not really hanging, its just waiting to receive build/bundle signals). This is correct. You have to open a second terminal then do react-native run-android.
If you get errors, then cd android in your project folder then run ./gradlew clean, then after that do another react-native start then react-native run-android.
Solution is to delete all java JDK and reinstall v8 / change JAVA_HOME to the new path.
Also changing gradle-wrapper.propertiesfile for each project you want to run
# update gradle to latest version
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
Sometimes it dosen't compile with v4 so I have to use v3. React native is definitely confusing.
after install dan update environment JDK now I can install app on my device

React Native Not Running projects that I copied from Windows machine to Ubuntu

I just moved to Ubuntu from Windows 10, I have installed react-native on my laptop and everytime I do react-native init it creates a project as expected. react-native run-android & react-native start commands are working as you'd expect them to be.
My main problem is I just copied a react native project from my Windows 10 machine to Ubuntu and now everytime I do react-native run-android This is the error I see on my console
This is the error I see on my console
Starting JS server...
Running /home/adeel/Android/Sdk//platform-tools/adb reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && ./gradlew installDebug...
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
The problem was the React Native project was created in Windows and I was trying to run it in a Linux based platform. So what I did was I created a brand new project in my Linux environment and copied my RN code in the newly created project.
This was I believe due to the android file it created which is platform dependent. Windows and Linux have different GRADLE files. I hope this helps anyone who is having this issue.
Seems like it is not recognizing your device/emulator. Run "adb devices" to check. I guess you did the whole Android setup and installed Android Studio (SDK).