如何在Android Studio中为消息“调用要求API级别21(当前最小值为16)”启用lint错误? [英] How to enable lint error in Android Studio for message "Call requires API level 21 (current min is 16)"?

查看:313
本文介绍了如何在Android Studio中为消息“调用要求API级别21(当前最小值为16)”启用lint错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为 setImageTintList()的方法,该方法要求min API为21。但是,如果我在gradle中将min API设置为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( )-调用需要API级别21(当前最小值为16)

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

它不会显示任何警告,错误或编译错误。

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

我如何在android studio中设置皮棉警告级别,使其在出现这种情况时会出错并可能阻止构建?

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的gradle插件lint无法将无效的Android API调用报告为错误。

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

您可以使用 gradle-animalsniffer-plugin 来实现一样。

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

这篇关于如何在Android Studio中为消息“调用要求API级别21(当前最小值为16)”启用lint错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆