Linting extension for Android
This is an extension for Android Lint, adding new rules:
- RootPackage : Every .java file must be inside a custom package, not inside the root package.
ERROR
- MissingLauncher : Every application must have at least one launcher activity.
WARNING
- MoreThanOneLauncher : The application must have only one launcher activity.
WARNING
- LauncherActivityInLibrary : A library must not have a launcher activity.
ERROR
- IconInLibrary : A library must not have icons.
ERROR
- PermissionUsageInLibrary : A library must not use permissions.
WARNING
- ClassConstantName : Every class constant (static and final) must be named using UPPER_SNAKE_CASE.
WARNING
- LayoutIDFormat : Every id inside layouts or menus must be named using lowerCamelCase.
ERROR
Clone this repository
git clone https://github.com/Hazer/andlint.git
Enter to the project
cd andlint/
Build it
./gradlew build
Install it
./gradlew install
Verify whether the issues are registered with lint
lint --show RootPackage
Go to any Android project and run lint
./gradlew lint
Note: If you can't run
lint
directly, you may want to include android toolsPATH
in your~/.bash_profile
. (i.e.PATH=$PATH:~/Library/Android/sdk/tools
)Then run
source ~/.bash_profile
.
Add on your build.gradle
file
android {
lintOptions {
disable 'RootPackage','MoreThanOneLauncher'
...
}
}