[英]How to enable lint error in Android Studio for message “Call requires API level 21 (current min is 16)”?
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. 我有一个名为
setImageTintList()
的方法,该方法要求min API为21。但是,如果我在gradle中将min API设置为16,则该应用程序仍会生成而不会发出任何警告。
Although there is a red line saying: 尽管有一条红线说:
setImageTintList() - Call requires API level 21 (current min is 16)
setImageTintList()-调用需要API级别21(当前最小值为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? 我如何在android studio中设置皮棉警告级别,这样它会出错并可能在这种情况下阻止构建?
It appears the Android's gradle plugin lint is not able to report invalid Android API calls as errors. 看来Android的gradle插件lint无法将无效的Android API调用报告为错误。
But you can use the gradle-animalsniffer-plugin to achieve the same. 但是您可以使用gradle-animalsniffer-plugin实现相同的目的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.