Build an Android Lint in 25 Minutes
summary
Shows how to add a custom Android Lint rule that detects uses of a project-wide singleton (example BadReferenceObject) when referenced from Activities. Implements the rule as a SourceCodeScanner using UAST and PSI, registers it for Gradle via a registry and lint API version, and verifies it with a focused lintTestTask against small source stubs (tests run locally and report one warning). Gives practical tips: narrow rule scope, keep tiny test files for fast edit→test cycles, debug with breakpoints, and prefer UAST over PSI where suitable.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 2:55Android Lint components
- 7:31Lint rule setup
- 10:20Test code setup
- 14:47AST/PSI scanning
- 21:07Detecting bad refs
- 22:51Customizing reports
- 24:38Rule creation tips
- 25:22Implementation tips
- 26:45Summary
related talks
46mLint for Life: Your Customizable Guard On the Go
20mClean Code Base: Harnessing the Power of Android Lint and Custom Rules
15mClean Code Base: Harnessing the Power of Android Lint and Custom Rules
21mMastering Code Quality: A Deep Dive into Custom Linting for Android Developers
29mLint to the Finish Line
44mLint. What, Why, How?
21mGetting the most out of Android Lint
24mImprove your code with Lint checks for Kotlin
