Skip to content
A demo project that shows how to setup and write some basic custom lint checks.
Branch: master
Clone or download
alexjlockwood Merge pull request #1 from har5hit/patch-1
Removed duplicate classpath
Latest commit ae18be2 Oct 2, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Add hardcoded hex color detector Sep 23, 2019
checks Cleanup Sep 23, 2019
gradle/wrapper initial commit Sep 14, 2019
.gitignore initial commit Sep 14, 2019
LICENSE initial commit Sep 14, 2019 Update readme with additional checks Sep 23, 2019
build.gradle Removed duplicate classpath Oct 1, 2019
dependencies.gradle Update module structure Sep 14, 2019 initial commit Sep 14, 2019
gradlew initial commit Sep 14, 2019
gradlew.bat initial commit Sep 14, 2019
settings.gradle Update module structure Sep 14, 2019


This is a simple demo repo that shows how to configure and write custom lint checks in an Android project.

Custom lint checks

Custom lint checks are a great way to prohibit usages of certain classes and resources in a codebase. To demonstrate their power, this project contains the following custom lint checks:

You can see the lint checks show up as errors if you open this project in Android Studio and look at the MainActivity.kt and activity_main.xml files.

You can view the unit tests for each custom lint check here.

Project setup

This project contains the following two modules:

Lint check jar library (checks/)

This module is the lint check jar library that other Android library modules can consume. It contains the custom lint check implementations listed above, each of which are listed in the IssueRegistry class.

Android app module (app/)

This module contains a generic sample Android app. In order to get the custom lint checks running on the code in this module, it depends on the checks module in the app/build.gradle file:

dependencies {
    lintChecks project(':checks')

Additional resources

You can’t perform that action at this time.