How to enable lint error in Android Studio for message “Call requires API level 21 (current min is 16)”?

放肆的年华 提交于 2019-12-19 07:49:28

问题


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 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.



来源:https://stackoverflow.com/questions/39710692/how-to-enable-lint-error-in-android-studio-for-message-call-requires-api-level

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!