How to enable lint error in Android Studio for mes

2019-02-18 09:23发布

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条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-02-18 09:55

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.

查看更多
登录 后发表回答