what the purpose of the lint.jar and inspector.jar that we can find in some AAR?


What the purpose of the lint.jar and inspector.jar file that we can find at the root of some AAR (ex in androidx.work:work-runtime:2.7.0) ? Can the app can work without them ?



This is less than weakly documented, but I give my best to make some sense of it. First of all, this is an intended thing, as mentioned in the Android Dev Docs. Unluckily without an explanation, so we have to make the Sherlock.

Education never ends, Watson. It is a series of lessons, with the greatest for the last.

Sir Arthur Conan Doyle, "His Last Bow" (Sherlock Holmes, #8)

The Crime Scene

The files lint.jar and inspector.jar are outside the libs directory, so they are no common supplemental Java libraries for app runtime usage. And they are obviously no file of name scheme classes<N>.jar to be included into the APK building process. So probably they are not to be included into the resulting APK and shall serve some other purpose.

The Suspect

The file name lint.jar gives us a thread to pull. Lint is

[…] a code scanning tool […] that can help you to identify and correct problems with the structural quality of your code without having to execute the app or write test cases.

The term code here means source code as well as resource code (XML files). It’s pretty neat, to be honest. Anyway, there is definitely no reason for lint.jar to be part of the APK.

The Witnesses

There is an interesting Xamarin-android Github issue post here with a reference on the pull post there. The point of these posts is, that Xamarin didn’t get along with lint.jar and it turned out that it had to be excluded from the APK building process, quoting the first post

[…] as it is not meant to be included inside the app (it is only used by the IDE to provide linter warnings).


[…] the lint.jar file is only important for the IDE, and should not be included on the compile classpath or runtime classpath of the app.

The other post, which describes a Xamarin patch, points out that

[…] apparently there is a feature for implementing your own custom lint rules. These are placed in lint.jar and Android Studio runs them as needed.

This corresponds to the dry sentence from the Android Dev Docs:

When using Android Studio, configured lint and IDE inspections run whenever you build your app.

This also appears to explain the inspector.jar. Tearing apart the work-runtime-2.7.0.aar to check for its inspector.jar gave a trace to the androidx.work.inspection package, however the Android sources didn’t help much because of a lack of comments. But one can assume that inspector.jar also is used for code inspection.

The Verdict

The file lint.jar is used to customize the Lint rules, and therefore the code inspection process, for the specific AAR file it is included into. It is probably primarily used by the AAR developers themselves, but maybe is also provided to the users in case one wants to customize the AAR, at least its res directory. The file inspector.jar highly likely serves a similar purpose.

Neither lint.jar nor inspector.jar will be included into the APK. So if your computer runs out of its last kilobytes, you may kick them out of the AAR file without regret.

Answered By – Krokomot

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published