Android’s lint tool allows you to find common issues in your code by running code static analysis against your project. This tool performs some Android specific checks that some other code static analysis tools can’t do for you. The lint tools comes with the Android SDK under tools/lint. In its most simple form you can use this command:

1
lint <Android project folder>

I like this form because I can easily plug it to my CI system:

1
lint <Android project folder> --exitcode

Configuring

You can configure the errors or warnings lint shows you by placing a file named lint.xml in the root of your project. Inside this file you can specify if you want to make a specific message an error, a warning or ignore it completely:

1
2
3
4
<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="Registered" severity="ignore" />
</lint>

You can find a list of all the available warnings you can use:

1
lint --list
[ android  mobile  automation  debugging  java  productivity  programming  ]
Neovim as ESP32 IDE with Clangd LSP
Using Arduino Serial Monitor From Linux
Getting Started With Neovim
Passing Arguments To a Java Binary Ran With Bazel
Get arguments used to start a java process