问题
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