The Android version of Monica, the open source personal CRM. It aims to offer every feature of the web app, plus what only makes sense on a phone, and talks to any Monica instance through its public API. Written in Kotlin with Jetpack Compose.
- JDK 21 (pinned in
mise.toml, runmise install) - Android SDK with platform
android-37.2(Android Studio, or the command-line tools in~/Android/Sdk)
./gradlew assembleDebug # build the debug APK
./gradlew installDebug # install on a connected device or emulator
./gradlew testDebugUnitTest # unit tests
./gradlew connectedDebugAndroidTest # Keystore and SQLCipher tests (needs a device or emulator)
./gradlew lintDebug # Android Lint
./gradlew spotlessApply # format Kotlin code (ktlint)Every pull request and every commit on main is analysed at
SonarQube Cloud, in the monicahq
organisation like the web app. Anybody can read the results there without an account. A pull
request whose changed code fails the quality gate cannot be merged: the Analysis check of CI turns
red. Pull requests from forks and from Dependabot get no access to SonarQube Cloud, so they are not
analysed until they are merged.
The analysis runs through the SonarScanner Gradle plugin (./gradlew sonar); its settings are in
the sonar { } block of app/build.gradle.kts. CI signs in to SonarQube
Cloud with the job's GitHub OIDC token: no stored secret.
Coverage comes from the unit tests, through the same Kover run as the 80% coverage gate. Screens,
sheets, the theme, MainActivity.kt, MonicaApplication.kt and SignedInApp.kt are left out, as
they are from the Kover gate: they hold no logic, and the app has no UI tests. One difference remains:
Kover leaves out code by annotation (@Composable), the analysis by file, so the one function of
SignedInApp.kt that is not a composable is measured by Kover only. A new file holding composables
is named *Screen.kt or *Sheet.kt, or added to both lists (the kover { } and sonar { } blocks
of app/build.gradle.kts).
In this order, because a required check that never reports blocks every open pull request:
- In SonarQube Cloud, create the public project
monicahq_androidin themonicahqorganisation, bound to this GitHub repository (the OIDC sign-in only works for a bound project), and turn Automatic Analysis off. - Check that the first analysis signs in: the "Authenticate to SonarQube Cloud" step of the
Analysisjob succeeds. - Merge the pull request that adds the analysis. Its run on
mainis the reference later pull requests are compared with. - Once coverage shows on the project page, add
Analysisto the required status checks of themainruleset.
Release builds only accept https:// instances. Debug builds also accept http:// and
user-installed certificate authorities, to reach a Monica running on your machine: from the
emulator, enter http://10.0.2.2:8000 (your Monica's port) as the instance, and set Monica's
APP_URL to that same address. See Architecture.
The project rules are in the constitution. In short: simple code, official Android best practices, everything unit tested, thin screens without UI tests, native Android only.
- Architecture: how screens, ViewModels and repositories fit together
- Testing: what to test and how
- Accessibility: mandatory rules and checks for every screen
This repo uses Spec Kit:
/speckit-constitution: project principles (once)/speckit-specify: describe a feature (it first updatesmainand creates a dated branch from it)/speckit-clarify(optional), then/speckit-plan/speckit-tasks, then/speckit-implement
Specs live in specs/, the constitution in .specify/memory/constitution.md.