Using tools ignore in xml files
suggest changeThe attribute tools:ignore can be used in xml files to dismiss lint warnings.
BUT dismissing lint warnings with this technique is most of the time the wrong way to proceed.
A lint warning must be understood and fixed. It can be ignored if and only if you have a full understanding of its meaning and a strong reason to ignore it.
Here is a use case where it is legitimate to ignore a lint warning:
- You are developing a system app (signed with the device manufacturer key)
- Your app needs to change the device date (or any other protected action)
Then you can do this in your manifest (request the protected permission and ignore the lint warning because you know that in your case the permission will be granted):
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SET_TIME"
tools:ignore="ProtectedPermissions"/>
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents