installation - msupply-foundation/mobile GitHub Wiki
- Before continuing, make sure you have installed all the required prerequisites.
- You must have Environment variable(s) setup in your system to use the admin setting panel.
- Clone the repo:
git clone https://github.com/openmsupply/mobile.git
. - Setup local node environment as specified in
.nvmrc
:nvm install && nvm use
. - Setup Java using sdkman:
sdk use java 10.0.2-zulu
- Install/update app dependencies:
yarn install
. Note: this process can take some time, be patient!
- Using Android Studio. Go to Configure > AVD Manager. Run the Android emulator
- Make sure:
- No mSupply Mobile is installed on the device
- Previous Bundler Terminal windows are closed!
- Java version and NVM version are correctly set.
- If you are using nvm, have multiple version of node and have a newer version of node installed in your system as the default Node version, running
react-native run-android
will build in the expected version (v14.21.3 while writing is) but will open a new terminal window for metro. Metro window thus opened would be in the default version of Node.JS in your system, which could be greater than the expected version. The build will hence fail. To tackle this manually start a metro instance and build in a separate terminal.- Open a terminal window, navigate to the mobile repo directory and set it to the expected version of node with
nvm use
. - Run
yarn start
- Open another terminal window, navigate to the mobile repo directory and set it to the expected version of node with
nvm use
. - Run react-native
run-android
oryarn android
- Open a terminal window, navigate to the mobile repo directory and set it to the expected version of node with
- If you have only one version of Node installed, and it is the expected version of this repo. Or if you have the expected version of this repo set as the default version of Node in your system. Run the command to start mSupply on the Android emulator:
react-native run-android
oryarn android
- Run
yarn start --reset-cache --host 127.0.0.1
to clear cache and to get the Server listening - Run
yarn android --no-packager
--> build and launch the Android app on a connected device or emulator, without starting the Metro bundler (packager) - Run
cd android && ./gradlew clean && cd ..
--> To delete the old app so that a new one can be built for the emulator - Run
nvm alias default 14.21.3
--> To set the Node default to use
V8.7.0
- Now Node V14.21.3 friendly