How to build the app on Ubuntu 18.04
- Clone repository and select branch fairchat-master (or mergeWith1.n.n)
$ git clone git@git.fairkom.net:chat/fairchat.ReactNative.git $ cd fairchat.ReactNative $ git checkout fairchat-master
(or checkout the branch with latest merge from upstream Rocket.Chat-ReactNative)
-
Install OpenJDK 8 (version 11 may have problems as some libraries are deprecated like java.se.ee) and check if both java and javac are the same version 8
-
Install Android Studio custom set-up with checkboxes on for:
Android SDK Android SDK Platform Android Virtual Device
(see also https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment )
```bash
export ANDROID_HOME=~/Software/AndroidSDK
```
-
Install dependencies from working dir and be sure to have a stable node version (10.13 works fine, not 8, 12 is not yet supported by realm package as of Oct 2019)
$ sudo apt install nodejs npm curl $ sudo npm cache clean -f $ sudo npm install -g n $ sudo n 10 $ sudo npm install -g yarn $ sudo npm install -g react-native-cli $ sudo chown -R $USER:$(id -gn $USER) /home/ras/.config $ npm install --save realm $ yarn global add react-native-cli $ yarn config set cache-folder /media/someGBstorage/yarn/cache/ $ yarn
-
forward 8081 ports if device is connected via USB (or change dev settings in device to connect via same WIFI to port 8081 on pc)
$ adb reverse tcp:8081 tcp:8081
-
Run Metro handler on port 8081 in separate terminal window in same working dir
$ npm start
You might need to restart it after major commits with new dependencies.
-
Build and run application
$ react-native run-ios
$ react-native run-android
-
Changing branch or merging commits requires full rebuild (react-native should not require this ...)
$ git checkout newfeature
$ yarn
$ react-native run-android
- If you want to rebuild the storybook
yarn add --dev jest
yarn global add jest
jest --updateSnapshot
Remove checks with pre-commit (syntax checks)
rm -f .git/hooks/*
For a release build, install keystore https://git.fairkom.net/chat/fairchat.ReactNative/issues/23 and run
$ react-native run-android --variant=release
```