Setting Up the Expo project in the NATIVE/ folder

Follow this tutorial to set up and run the Expo project located in the NATIVE/ folder. Choose your preferred method using the tabs below.

Prerequisite

Make sure you have Node.js v20 or higher installed. You can check your version with:

 node --version

1. Initial Setup

Inside the NATIVE/ directory, copy the .env.sample file to .env and fill in the required values. The value for EXPO_PUBLIC_DEVELOPMENT_IP_ADDRESS is the computer local IP address (e.g., 192.168.XX.X). Also make sure to add this IP address to the src/.env file as part of the ALLOWED_HOSTS variable.

To obtain this, run the following command in your terminal:

  • run the following command in your terminal:

    ipconfig getifaddr en0
    

For now, you can leave EXPO_PUBLIC_PRODUCTION_BASE_URL empty. This will be set up later when we deploy the app.

cd NATIVE/
yarn install

2. Running the App

  1. Install Android Studio Download and install Android Studio.

  2. Set Up an Emulator

    • Open Android Studio.

    • Go to Device Manager.

    • Create and start a new virtual device.

  3. Start the Expo Project

    npx expo start -c
    
    • Press a in the Expo CLI to launch the app on the emulator.

3. Note about local Django backend

The app is set up to connect to a local Django backend server. To run the backend server, follow the instructions in the Backend Setup tutorial. Make sure to set the EXPO_PUBLIC_DEVELOPMENT_IP_ADDRESS in the .env file to your local IP address (e.g., 192.168.XX.X) and add this IP address to the ALLOWED_HOSTS variable in the src/.env file.

Troubleshooting

(Mac Users) if you encounter this error when running npx expo run:android:

user@host:~$
A problem occurred evaluating root project 'kurazetu'.
> Failed to apply plugin 'com.facebook.react.rootproject'.
   > A problem occurred configuring project ':app'.
      > SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/'your-user-name'/Documents/code/KuraZetu/NATIVE/android/local.properties'.

Then create a local.properties file in the android folder with the following command:

echo "sdk.dir=$HOME/Library/Android/sdk" > "$(pwd)/android/local.properties"