Skip to main content

Development setup instructions

Prerequisites

tip

If you are building in the app for prototyping, testing, or demo purposes, you can freely build locally for Android without requesting access or keys.

You can also consider using our codespaces setup to get up and running quickly.

Access

  • You have been fully onboarding into the VA Github organiztion.
  • An SSH key setup with github: Connect With SSH.
  • You or your team has been approved to build and release a production feature into the VA Mobile App by a VA Product Owner.
  • If your feature is approved, reach out to Flagship support to get access to App Store Connect so you can build the iOS app locally.

Software

Environment variables setup

If you are using zsh on Mac you will need to create the .zprofile and .zshrc files if they do not exists.

In your bash_profile or .zprofile add the following:

# JAVA_HOME` variable pointing to the java installed above example
export JAVA_HOME=$(/usr/libexec/java_home -v 15.0.2)

# `NODE_OPTIONS` this is to manage the node memory space
export NODE_OPTIONS=--max_old_space_size=8192

# Android specific vars for the ANDROID_HOME, platform-tools and cmdline-tools
export ANDROID_SDK=/Users/(your user folder)/Library/Android/sdk
export ANDROID_HOME=$ANDROID_SDK
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

# The build of the app relies on a scripted creation of the .env
# file to run correctly. You will need to add the `APP_CLIENT_SECRET`
# var to work correctly:
export APP_CLIENT_SECRET='client secret ask for this client key'

# The app has a demo mode. To use demo mode the app reads the
# `DEMO_PASSWORD` var. You can set this to a blank password or
# assign any string to it

export DEMO_PASSWORD=''

After adding the variables, restart your terminal window and the variables should be activated. Run which adb to make sure the android variables are working. If they are not, please reach out to Flagship support.

Local project setup

  1. Verify you have access to the Firebase console. If you don't, please reach out to Flagship support.
  2. With your preferred code editor, navigate to the va-mobile-app/VAMobile folder inside your cloned version of the repository.
  3. In the android/app directory add a file named google-services.json. You can download this google-services.json file from the firebase console, under the "your apps" section. You can also download the corresponding GoogleService-Info.plist file you will need to later place in your in VAMobile/ios.

Download the files from Firebase

Android

Firebase console apps section where you can find the google services file for Android

iOS

Firebase console apps section where you can find the google services file for iOS

Add file to proper directory

Google services file

  1. Open a terminal and type nvm use and press enter to set the node version for the project (if the version isn't installed, it will prompt you with the install command).
  2. In a terminal, type yarn or yarn install and press enter to install the projects dependencies. This will create the node_modules folder.
  3. After dependencies are installed, type cd ios && pod install && cd .. and press enter to install pods on iOS (This is done once unless you installed new dependencies that need pods created).
  4. Run yarn env:staging and press enter to setup the staging environment and create the .env file. Verify the file has the client key and demo password that is in your .zshrc file.
  5. Run yarn bundle:ios and press enter to create the IOS bundle.
  6. Run yarn bundle:android and press enter to create the android bundle.
  7. Run yarn start to start the metro development server.

Android Setup

Emulator Setup

  1. Open Android Studios and select to a open project.

    Open Android Studio

  2. On the popup window, browse to va-mobile-app/VAMobile/android and select the android folder from the VAMobile project and press open.

    Select Android Folder

  3. After opening the android project, you will need to sync the project with gradle. Go to File -> Sync Project With Gradle Files.

    Sync With Gradle

  4. Go to Android Studios -> Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle and verify that the Gradle JDK is pointing to /Applications/Android Studio.app/Contents/jre/Contents/Home

    Preference Android

    Gradle Java Path

  5. Add a test emulator in Android Studios Tools -> AVD Manager. Follow the instructions on Android Emulator Setup to add a new virtual device.

  6. After adding the new virtual device, select it from the top device menu.

    Select Device

  7. Build the project

    Build Project

  8. Launch Virtual Device from Android studio.

    Launch Project

  9. Verify the Virtual Device launches and Android Studio installs and opens the VAMobile app on the device.

Physical Device Setup

  1. Open Android Studio and select to a open project.

    Open Android Studio

  2. On the popup window, browse to va-mobile-app/VAMobile/android and select the android folder from the VAMobile project and press open.

    Select Android Folder

  3. After opening the android project, you will need to sync the project with gradle. Go to File -> Sync Project With Gradle Files.

    Sync With Gradle

  4. Go to Android Studio -> Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle and verify that the Gradle JDK is pointing to /Applications/Android Studio.app/Contents/jre/Contents/Home

    Preference Android

    Gradle Java Path

  5. Turn on developer mode for the phone. See React Native Instructions

  6. Connect phone with a usb to the host machine.

  7. Open a Terminal and type adb devices. You should see an ouput like so.

    ADB Devices

  8. Type adb -s <device name> reverse tcp:8081 tcp:8081.

    ADB TCP Reverse

  9. Select the physical device from the top device menu.

    Select Device

  10. Build the project

    Build Project

  11. Launch Virtual Device from Android Studio.

    Launch Project

  12. Verify Android Studio installs and opens the VAMobile app on the device.

iOS Setup

Simulator Setup

  1. Open Xcode and select to open project or file.

    Open Xcode Project

  2. On the popup window browse and select the ios folder on the VAMobile project.

    Select Project Xcode

  3. Go to Xcode -> Preference and under account verify you are signed in with the apple id which has the US Department of Veterans Affairs (VA) developer account.

    Apple Id Account

    Apple Id Account

  4. Select the project icon on the left hand explorer and verify you have the right signing. Team should be US Department of Veterans Affairs (VA)

    Signing Project Account

  5. Select a simulator from the list in Xcode.

    Select Simulator Xcode

  6. If you are using XCode 15, a temporary workaround is required to avoid a build failure with RCT-Folly.

    a. Select Pods > Build Settings > Apple Clang - Preprocessing section > Preprocessor Macros section b. Add to the "Debug" and "Release" sections: _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION

    XCode 15 workaround

  7. Build project on Xcode.

    Build Project Xcode

  8. Launch simulator by pressing the play button.

    Launch Simulator Xcode

Physical Device

  1. Open Xcode and select to open project or file.

    Open Xcode Project

  2. On the popup window browse and select the ios folder on the VAMobile project.

    Select Project Xcode

  3. Go to Xcode -> Preference and under account verify you are signed in with the apple id which has the US Department of Veterans Affairs (VA) developer account.

    Apple Id Account

    Apple Id Account

  4. Select the project icon on the left hand explorer and verify you have the right signing. Team should be US Department of Veterans Affairs (VA).

    Signing Project Account

  5. Connect the iPhone via USB to the host machine. See React Native Instructions

  6. Accept permissions on your iPhone from Xcode to allow the developers option.

  7. Select a device from the list in Xcode.

    Select Simulator Xcode

  8. Build project on Xcode.

    Build Project Xcode

  9. Launch device by pressing the play button.

    Launch Simulator Xcode