6
votes

I have a method called setImageTintList() that requires min API to be 21. But, if I set my min API to 16 in gradle, the app still builds without any warning.

Although there is a red line saying:

setImageTintList() - Call requires API level 21 (current min is 16)

it does not show any warning, error or compile error.

How can I set the lint warning level in android studio such that it will error out and possibly prevent the build in cases like this?

1
It will compile, but it will probably crash if older versions of the app (pre 21) hit the method. - zgc7009
@zgc7009 Yup. The app crashes on api < 21. - AccTest
Did you find any solutions for this issue? I can't see the message also. - Orcun Sevsay

1 Answers

0
votes

It appears the Android's gradle plugin lint is not able to report invalid Android API calls as errors.

But you can use the gradle-animalsniffer-plugin to achieve the same.