diff --git a/dont-kill-me-lib/build.gradle b/dont-kill-me-lib/build.gradle
index 8e3efb0bc1cb30059689ccdfa69d0c0e1ed38c16..58d6d8571269a7ebf39b34cf3fa9f6fe093c6fb1 100644
--- a/dont-kill-me-lib/build.gradle
+++ b/dont-kill-me-lib/build.gradle
@@ -1,5 +1,6 @@
 plugins {
     id 'com.android.library'
+    id 'checkstyle' // only needed for Java code
 }
 
 android {
@@ -27,3 +28,5 @@ android {
 dependencies {
     implementation "androidx.annotation:annotation:1.3.0"
 }
+
+apply from: "${rootProject.rootDir}/gradle/checkstyle.gradle"
diff --git a/gradle/checkstyle.gradle b/gradle/checkstyle.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..a280dc68c8c3400e0b45e343d0898e2695611606
--- /dev/null
+++ b/gradle/checkstyle.gradle
@@ -0,0 +1,29 @@
+task checkstyleMain(type: Checkstyle) {
+    source 'src/main/java'
+    include '**/*.java'
+    classpath = files()
+    reports {
+        xml {
+            destination file("build/reports/checkstyle/main.xml")
+        }
+        html {
+            destination file("build/reports/checkstyle/main.html")
+        }
+    }
+    check.dependsOn it
+}
+
+task checkstyleTest(type: Checkstyle) {
+    source 'src/test/java'
+    include '**/*.java'
+    classpath = files()
+    reports {
+        xml {
+            destination file("build/reports/checkstyle/test.xml")
+        }
+        html {
+            destination file("build/reports/checkstyle/test.html")
+        }
+    }
+    check.dependsOn it
+}
diff --git a/mailbox-android/build.gradle b/mailbox-android/build.gradle
index b692d5392654f4d934b7f2d2dd8a9f47cd2bb069..66bd53bbd121332a184c330f1d841a44d79b4b3b 100644
--- a/mailbox-android/build.gradle
+++ b/mailbox-android/build.gradle
@@ -152,3 +152,4 @@ tasks.withType(MergeResources) {
 }
 
 apply from: "${rootProject.rootDir}/gradle/ktlint.gradle"
+apply from: "${rootProject.rootDir}/gradle/checkstyle.gradle"