Skip to content

BuildingK9

Giulio Portioli edited this page Dec 31, 2020 · 49 revisions

How to build K-9 Mail

Introduction

K-9 Mail targets Java 8. New code is written in Kotlin. The current development version of K-9 Mail runs on Android 5.0 (API level 21) and newer versions.

Requirements

Install the following via the Android SDK Manager:

  • Android SDK Build-tools 29.0.2
  • SDK Platform 29

Building with Android Studio

If you want to modify K-9 Mail we highly recommend using Android Studio.

Use the "Import project" functionality of Android Studio to start the import wizard. Then select the directory into which you cloned the K-9 Mail repository. The rest should happen automatically.

Building with Gradle on the command line

To be able to build K-9 Mail on the command line, you need the Java Development Kit (JDK) version 8 installed. On most Linux distributions openjdk-8-jdk can be installed via the package manager. For all other platforms try AdoptOpenJDK.

To create a debug build on Unix-based systems use the command:

./gradlew assembleDebug

On Windows open the command prompt and enter the command:

gradlew.bat assembleDebug

Check/fix code style

We use ktlint to enforce code style rules for Kotlin code. To check for code style violations use the command:

./gradlew ktlintCheck

To automatically fix most code style violations use the command:

./gradlew ktlintFormat

Running tests

To run the tests use the command:

./gradlew testDebugUnitTest