Mastering Your First React Native Project: A Comprehensive Guide πŸ§‘β€πŸ’»

Β·

2 min read

When I initially began working on my react-native application, it seemed like a daunting task as my emulator struggled to display the boilerplate codeπŸ‘¨β€πŸ’» on the screen. I wondered what mistake I had made, but after hours of puzzling 😡 over it, I discovered a simple solution (which actually only took a few minutes ⏳ to fix).

Here are the steps below:

  1. Open your React Native project.

  2. Right-click on the project folder, select "Open in Terminal," and enter 'code .' to open the project in VSCode.

  3. Start the Metro bundler by running the command 'npx react-native start'. This will launch the Metro bundler, which runs on port 8081 and provides several options, including:

    • 'i' for running on iOS

    • 'a' for running on Android

    • 'd' to open the Dev Menu

    • 'r' to reload the app

  4. Choose the 'a' option to run the app on Android.

  5. If you encounter the error message stating "SDK location not found," follow these additional steps:

    • Create a new file named "local.properties" inside the "android" directory of your project.

    • Add the following line to the "local.properties" file according to your system preferences:

    //for windows
    sdk.dir=C\:\\Users\\username\\AppData\\Local\\Android\\Sdk
    //for mac
    sdk.dir=/Users/username/Library/Android/sdk

Replace 'username' with your actual username.

By following these steps, you should be able to resolve the SDK location issue and continue developing your React Native application smoothly πŸ€—πŸš€.

Β