Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ProtonVPN/android-app/llms.txt

Use this file to discover all available pages before exploring further.

The project enforces consistent code style through a shared scheme file for Java and ktlint for Kotlin. CI runs both checkstyle and detekt on every pull request.

Language policy

The codebase is being migrated from Java to Kotlin. New code should be written in Kotlin wherever possible. Large refactors should conform to the preferred tech stack: Kotlin, MVVM, data-binding, and coroutines.

Java code style

Java code follows the ProtonStyle.xml code scheme, located at the root of the repository. Import it into Android Studio to ensure your IDE formats code consistently with the rest of the project.
1

Open the Code Style settings

In Android Studio, go to File > Settings > Editor > Code Style (on macOS: Android Studio > Settings > Editor > Code Style).
2

Import the scheme

Click the gear icon next to the Scheme dropdown and select Import Scheme.
3

Select ProtonStyle.xml

Navigate to the root of the android-app repository and select ProtonStyle.xml.
4

Apply the scheme

Select the imported Project scheme from the dropdown and click Apply.
The scheme configures:
  • Star imports are disabled (import threshold set to Integer.MAX_VALUE)
  • XML attribute ordering follows Android conventions (xmlns:android first, then other xmlns:* alphabetically, then android:id, android:name, and so on)
  • Kotlin right margin set to 120 characters
  • Continuation indent size of 4 for both XML and Kotlin

Kotlin code style

Kotlin code uses ktlint with its default ruleset, based on the official Kotlin coding conventions. No custom ruleset is applied — the default ktlint rules are sufficient. Detekt is also configured to catch common issues. The detekt ruleset is downloaded from the shared Proton Core configuration at build time.

Running static analysis

Run these commands locally before opening a pull request to catch issues early.
./gradlew checkstyle
The detekt configuration is fetched from the ProtonCore repository on first run and cached for 24 hours. If the download fails (for example, in an offline environment), the task will throw an error. You can work around this by committing a local copy of the config to config/detekt/config.yml.

Tech stack conventions

New features and significant refactors should follow these architectural conventions:
AreaPreferred approach
ArchitectureMVVM
UI data flowData-binding or Jetpack Compose
Async workKotlin coroutines
Dependency injectionHilt
DatabaseRoom
NavigationJetpack Navigation
Avoid introducing new Java classes. If you are modifying an existing Java file, consider converting it to Kotlin as part of your change.

Build docs developers (and LLMs) love