An Android app for recording blood pressure measurements.
The application currently requires JDK 17 to build. If you already have JDK 17 installed, skip this step.
Check if the right JDK is already available
Run the command java -version
. If you have the right version of the JDK installed, you should see something like:
openjdk 17.0.7 2023-04-18 LTS
OpenJDK Runtime Environment Zulu17.42+19-CA (build 17.0.7+7-LTS)
OpenJDK 64-Bit Server VM Zulu17.42+19-CA (build 17.0.7+7-LTS, mixed mode, sharing)
If this command has an error, or shows a different version, you can follow the instructions below to install the JDK.
Install the JDK
We recommend using jEnv to manage your JDK installations. Here are instructions to setup a working JDK 17 installation (macOS only):
-
Setup up Homebrew.
-
Install
jEnv
using Homebrew.
brew install jenv
- Add the following lines to your shell configuration file (
~/.bash_profile
if you're using bash, or~/.zshrc
if you're using zsh).
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
- Once this is done, you'll need to restart the terminal or reload the configuration file in order for the
jenv
command to be recognised.
source <path to shell configuration file>
- Install the JDK using Homebrew.
brew tap mdogan/zulu
brew install zulu-jdk17
- Add the installed JDK to
jEnv
jenv add /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home/
- Run the command
jenv versions
. You should see something like:
system
* 17.0
17.0.7
zulu64-17.0.7
Clone the project using git.
Run the following command in a terminal.
$ git clone git@github.com:simpledotorg/simple-android.git
Install Android Studio
Download and install Android Studio from their website.
Import the project into Android Studio.
When Android Studio starts up, it will prompt you to create a new project or import an existing project. Select the option to import an existing
project, navigate to the simple-android
directory you cloned earlier, and select it.
When building for the first time, gradle will download all dependencies so it'll take a few minutes to complete. Subsequent builds will be faster.
If during the build process you see the message: "Warning: License for package Android SDK Build-Tools 30.0.2 not accepted." Then you may need to install the Google Play Licensing Library:
- Open the SDK Manager through Tools -> SDK Manager
- Select Appearance & Behavior -> System Settings -> Android SDK in the left sidebar
- Select the SDK Tools tab in the main window
- Activate Google Play Licensing Library and click Apply
The Simple App can be run locally on an Android emulator using Android Studio. To do this,
Install the NDK library
The NDK library is currently required by the project to enable an SQLite extension. To install it:
- Open the SDK Manager through Tools -> SDK Manager
- Select Appearance & Behavior -> System Settings -> Android SDK in the left sidebar
- Select the SDK Tools tab in the main window
- Activate NDK (Side by Side) and click Apply
NDK will now be installed.
Create a Run/Debug configuration
- Open the Run/Debug configurations window through Run -> Edit Configurations (ref)
- Create a new configuration using the
Android App
template - Set the module to
app
, and finish creating the configuration
Create a virtual device
- Create an Android Virtual Device (AVD) using the AVD Manager, usually found in Tools -> AVD Manager. (ref)
- Select a device and operating system
- Note: You will have to download one of the available OS options the first time you create an AVD
Set the right build variant
- Open the Build Variants window through View -> Tool Windows -> Build Variants, or clicking the item in the lower left corner of the main window
- Set the Build Variant of the app module to
qaDebug
Run the app
- Click "Run", either through Run -> Run, or the green play button in the top toolbar.
The code styles which the project uses have been exported as an IntelliJ code style XML file and are saved as
quality/code-style.xml
. To import them into Android Studio,
- Open the Android Studio preferences page, and navigate to Editor -> Code Style.
- Click on the gear/settings button next to the "Scheme" label.
- In the drop-down menu, select "Import scheme".
- In the file picker, navigate to
<project>/quality/code-style.xml
. - Import the
Simple
scheme into the IDE and set it as the project code style.
An Android Studio plugin that provides some quality of life improvements like live templates can be found HERE.
There are currently 2 ways to build an app pointing to different environments:
- Changing the
qa
API URL ingradle.properties
file to point to the environment you want. These builds will be debuggable and require us to clone the project and build it using Android Studio. [* Warning*: These changes should not be commited back tomaster
branch] - Use Bitrise workflows to build APKs of different build variants. These builds will not be debuggable, unless for
build-debuggable-sandbox-apk
.
Simple Server is in a separate repository, and you should follow the instructions there.
You can use Flipper to run SQL queries on Simple:
- Install Flipper using brew or download from their website.
brew install Flipper
- Launch Flipper (you might have to allow Flipper to launch from System Preferences > Security > General as it’s from an unknown developer to Apple).
- Run the Simple app in an emulator or your physical device(as Flipper loads the data from your device's local database).
- In the Plugins section in the sidebar menu click on Disabled and enable the Database plugin.
- Click on Databases, select
red-db
and choose whichever table’s data you want to inspect. - Click on SQL at the top to execute SQL queries.
Check out the following documents for more information.