Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android adding custom lint rule to the project (git)

Tags:

git

android

lint

I needed a custom lint rule, so created one using the steps from here

All is working ok, the custom rule is now checked by lint. However, I have added the custom rule .jar to /.android/lint path. But this means that this rule is checked only for me locally.

The location of the .android directory is typically the home directory; lint will search in $ANDROID_SDK_HOME, in ${user.home} (the Java property), and in $HOME. (Somebody asked about this; Lint basically calls the general Android tools method to find the "tools settings directory", used for emulator snapshots, ddms configuration, etc. You can find the relevant code for that here: https://android.googlesource.com/platform/tools/base/+/master/common/src/main/java/com/android/prefs/AndroidLocation.java )

How can I add the .jar file to the project such that all the people working on it will have this lint rule checked? Searched for an answer but didn't find any clues...

like image 434
Mihaela Romanca Avatar asked Nov 11 '22 12:11

Mihaela Romanca


1 Answers

The new AAR format allows to compile and bundle custom lint rules which is perfect for distributed working OR CI environments, like mentioned here [1].

Another suitable solution is to have your custom lint rule as module/project dependency within your application project.

  1. https://engineering.linkedin.com/android/writing-custom-lint-checks-gradle
like image 70
André Diermann Avatar answered Nov 14 '22 23:11

André Diermann