- The first thing you need to do is install Nodejs which can be found here.
- Once the installation is complete you can check it by searching ‘Node’ in the start window.
- This search should reveal Node.js, Node.js command prompt, and a few links to the Node.js documentation and website.
- The installation should also come along with npm which is a package manager.
- You can check this by opening up the Node.js command prompt and running the command
npm -v
which will return your current version.
-
Next, we will update npm by running
npm install -g npm@latest-4
. This command installs the latest version of npm globally on your system. -
After that we will install React Native with the command
npm install -g react-native-cli
. This will install the react native command line interface which allows you to scaffold react native apps. - Install the android sdk. You must also install the Java development kit.
- Once both are installed you will need to setup your environment variable.
- To do this click start and right click on computer. Then click ‘properties’
- This should bring you to the system window.
- On the left hand side click Advanced system settings then click ‘Environment Variable’
- Click ‘new’ under the user variables section and enter ‘ANDROID_HOME’ for variable name.
- Then enter the location of your sdk folder under variable value. In my case this location is ‘C:\Users\Omars-PC\AppData\Local\Android\sdk’
- Then add the next variable ‘JAVA_HOME’ with location for variable value. For me it is ‘C:\Program Files\Java\jre1.8.0_144’
- Once that is all complete you can scaffold your first react app by running
react-native init APPNAMEHERE
- This will take some time to complete. After it finishes, open android studio and click the option to open existing project.
- From there find the folder of the react native app and click on the android folder.
- Next click the sdk manager icon at the top of the android studio window.
- From there click Android SDK and click the SDK Platforms tab.
- From this tab click the show package details checkbox, then check the boxes for each android version that you would like to build apps for and click apply.
- After that’s complete click AVD Manger Icon at the top of the Android Studio window.
- This will show your virtual devices. You most likely don’t have any so just create one and choose the device you would like to test your app with.
- After creating your virtual device run it
- Next in the command prompt run the command ‘react-native start’ then open a second command line and run ‘react-native run-android’
- This will compile your app and run it in the virtual device.
- You can use a code editor of your choice to edit the code.
That’s it! Happy Coding!