How to set-up React Native on your Windows Machine successfully
I got an insight to write this blog because of the challenge I had in setting up my react native coding environment. I am already a react developer for web. Before the set up I went through the start project react native with expo
npx create-expo-app@latest StickerSmash
at their website: https://docs.expo.dev/tutorial/create-your-first-app/
Haha, most of you would have probably gone through the project on their website and I used this expo command to run expo on my physical device and after going through the course guess what, I said to my self
Wow, React Native is very much easier than React for Web 🤣😂🤣
npx run expo --tunnel
Some replied me saying Ok and I felt like, well maybe its not that easy as I think.
Moving from React Web to React Native is Sweet, it has similar stuffs like the react hooks and code structure just slightly different for the (tabs) and _layout files.
So I was ready to work on a real react native project, after cloning the project, it was time to use expo then I realized I had to actually install android studio and setup.
Let me take you through the set up process and my challenges.
You would need the following installed on your windows
Node.js (https://nodejs.org/en)
Android Studio (https://androidstudio)
VS Code (https://code.visualstudio.com/)
Java JDK Version 17 (https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
After downloading them from their websites then install them and put them in their path (environmental variable). Let me show you mine:
User Variables for osimu
NOTE: osimu is my Username: replace with yours
ANDROID_HOME : C:\Users\osimu\AppData\Local\Android\Sdk
In the path put this 3 different paths
C:\Users\osimu\AppData\Local\Android\Sdk\tools
C:\Users\osimu\AppData\Local\Android\Sdk\tools\bin
C:\Users\osimu\AppData\Local\Android\Sdk\platform-tools
System Variable please add this to the path
%ANDROID_HOME%\bin
C:\Users\osimu\AppData\Local\Android\Sdk\platform-tools
After cloning the project you then run this code in your terminal
npm install
//after which you run
npm start
//then open another terminal and run
npm run andriod
before doing this I ran
npx react-native doctor
I wanted to see if I had any issues, of course I did, it was Android SDK Version not found, it was because I didn’t put those paths in my environmental variables. But I have taking you through that.
When I ran npm run android
it took me 40mins to set up and configure the project, depending on your machine, it will vary, some lesser and some much more.
Now you can go to your project files and start building.
Thank you.
More from me.
Osim Uka Okpan - Frontend Engineer at SmartWorks
Visit my website: https://osimuka.com
Subscribe to my newsletter
Read articles from Osim Uka Okpan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by