Rock your 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. ERROR
  • InstanceVariableName : Every instance variable must be named beginning with 'm' and using camelCase. WARNING
  • ClassConstantName : Every class constant (static and final) must be named using UPPER_SNAKE_CASE. WARNING
  • HardcodedText : A string cannot be hardcoded inside layouts or menus. Now this is an error, not a warning. ERROR
  • LayoutIDFormat : Every id inside layouts or menus must be named using lowerCamelCase. ERROR

Exceptions to InstanceVariableName rule:

  1. The class is a model (should be inside a package called 'models').
  2. The variable is declared using @Bind or @InjectView (ButterKnife).

Getting started

Clone this repository

git clone https://github.com/inaka/lewis.git

Enter to the project

cd lewis/

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 tools PATH in your ~/.bash_profile. (i.e. PATH=$PATH:~/Library/Android/sdk/tools)

Then run source ~/.bash_profile.

How to disable an issue

Add on your build.gradle file

android {
    lintOptions {
        disable 'RootPackage','MoreThanOneLauncher'
Become a better Android Developer
Millions of developers are learning at MindOrks

Online Training Program

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer

Become Pro in Android by watching videos