Up and Running 1st React Native App

Up and Running 1st React Native App

For the Android devices on Windows

Hola Coders

In this article, we will Execute our very first react native app in an android device.

To get started make sure, you have an android device with the USB cable.

Settings in Android Device

  1. Enable developer options in your android device, by clicking build number in the settings of the android mobile multiple times.

    Build Number: settings-> about-> version

  2. Go to Developer options, enable USB Debugging and select USB configuration to MTP(Media Transfer Protocol).

Now connect the device to the windows laptop with the USB cable.

Check if the device is connected properly by executing following in the command prompt. If, it shows your device then you are good to go.

adb devices

Creating the first Project

Execute the following command in the terminal

npx react-native init Awesome01

It will provide the boilerplate code and file structure for react native app.

Check scripts in package.json file

Execute the project

npx react-native run-android

If it builds the app successfully well and good!

Debugging the Installation

  • Encountered following error while executing the app.

SOLUTION: Add local.properties file in the android folder with the SDK Location.

Sub Problem: In my system SDK, wasn't installed. Need to install SDK manually using Android Studio.

Sub Error 2: After resolving SDK error , I faced another error

* What went wrong:
A problem occurred evaluating script.
> java.lang.StackOverflowError (no error message)

To solve this, need to check the build.gradle file and then I found out that Android version in my device is 12.

Then I installed compatible API using SDK manager.

Now I excecuted the command to run the app and the build got success and the app got executed in my android device.

These were errors faced by me to execute first project. I hope it will help you in creating first react-native project.

Thanks Hitesh Choudhary for amazing video and @hashnode for sponsoring.

The End

I hope you enjoyed the article and had a good learning experience.

Follow for more articles and keep sharing👩

Keep coding

Linkedin

hashnode blogs

Did you find this article valuable?

Support akshita garg by becoming a sponsor. Any amount is appreciated!