function requires backticks when used from Kotlin:val callable = Mockito.mock(Callable::class.java)
Mockito.`when`(callable.call()).thenReturn(/* … */)
To suppress this error, use the issue id "NoHardKeywords" as explained in the Suppressing Warnings and Errors section.
NotInterpolated
Disabled By: Project lint.xml file
To insert the value of a variable, you can use
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "NotInterpolated" as explained in the Suppressing Warnings and Errors section.
${variable}
inside a string literal, but only if you are using double quotes!Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "NotInterpolated" as explained in the Suppressing Warnings and Errors section.
NotificationIconCompatibility
Disabled By: Project lint.xml file
Notification icons should define a raster image to support Android versions below 5.0 (API 21). Note that the way Lint decides whether an icon is a notification icon is based on the filename prefix
To suppress this error, use the issue id "NotificationIconCompatibility" as explained in the Suppressing Warnings and Errors section.
ic_stat_
. This corresponds to the naming convention documented in http://developer.android.com/guide/practices/ui_guidelines/icon_design.htmlTo suppress this error, use the issue id "NotificationIconCompatibility" as explained in the Suppressing Warnings and Errors section.
ObjectAnimatorBinding
Disabled By: Project lint.xml file
This check cross references properties referenced by String from
To suppress this error, use the issue id "ObjectAnimatorBinding" as explained in the Suppressing Warnings and Errors section.
ObjectAnimator
and PropertyValuesHolder
method calls and ensures that the corresponding setter methods exist and have the right signatures.To suppress this error, use the issue id "ObjectAnimatorBinding" as explained in the Suppressing Warnings and Errors section.
ObsoleteLayoutParam
Disabled By: Project lint.xml file
The given layout_param is not defined for the given layout, meaning it has no effect. This usually happens when you change the parent layout or move view code around without updating the layout params. This will cause useless attribute processing at runtime, and is misleading for others reading the layout so the parameter should be removed.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ObsoleteLayoutParam" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ObsoleteLayoutParam" as explained in the Suppressing Warnings and Errors section.
ObsoleteSdkInt
Disabled By: Project lint.xml file
This check flags version checks that are not necessary, because the
Similarly, it also looks for resources in
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ObsoleteSdkInt" as explained in the Suppressing Warnings and Errors section.
minSdkVersion
(or surrounding known API level) is already at least as high as the version checked for.Similarly, it also looks for resources in
-vNN
folders, such as values-v14
where the version qualifier is less than or equal to the minSdkVersion
, where the contents should be merged into the best folder.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ObsoleteSdkInt" as explained in the Suppressing Warnings and Errors section.
OldTargetApi
Disabled By: Project lint.xml file
When your application runs on a version of Android that is more recent than your
To fix this issue, set the
https://developer.android.com/distribute/best-practices/develop/target-sdk.html
To suppress this error, use the issue id "OldTargetApi" as explained in the Suppressing Warnings and Errors section.
targetSdkVersion
specifies that it has been tested with, various compatibility modes kick in. This ensures that your application continues to work, but it may look out of place. For example, if the targetSdkVersion
is less than 14, your app may get an option button in the UI.To fix this issue, set the
targetSdkVersion
to the highest available value. Then test your app to make sure everything works correctly. You may want to consult the compatibility notes to see what changes apply to each version you are adding support for: http://developer.android.com/reference/android/os/Build.VERSION_CODES.html as well as follow this guide:https://developer.android.com/distribute/best-practices/develop/target-sdk.html
More info:
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "OldTargetApi" as explained in the Suppressing Warnings and Errors section.
OnClick
Disabled By: Project lint.xml file
The
Must be a string value, using '\;' to escape characters such as '\n' or '\uxxxx' for a unicode character.
To suppress this error, use the issue id "OnClick" as explained in the Suppressing Warnings and Errors section.
onClick
attribute value should be the name of a method in this View's context to invoke when the view is clicked. This name must correspond to a public method that takes exactly one parameter of type View
.Must be a string value, using '\;' to escape characters such as '\n' or '\uxxxx' for a unicode character.
To suppress this error, use the issue id "OnClick" as explained in the Suppressing Warnings and Errors section.
Orientation
Disabled By: Project lint.xml file
The default orientation of a LinearLayout is horizontal. It's pretty easy to believe that the layout is vertical, add multiple children to it, and wonder why only the first child is visible (when the subsequent children are off screen to the right). This lint rule helps pinpoint this issue by warning whenever a LinearLayout is used with an implicit orientation and multiple children.
It also checks for empty LinearLayouts without an
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "Orientation" as explained in the Suppressing Warnings and Errors section.
It also checks for empty LinearLayouts without an
orientation
attribute that also defines an id
attribute. This catches the scenarios where children will be added to the LinearLayout
dynamically. Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "Orientation" as explained in the Suppressing Warnings and Errors section.
OutdatedLibrary
Disabled By: Project lint.xml file
Your app is using an outdated version of a library. This may cause violations of Google Play policies (see https://play.google.com/about/monetization-ads/ads/) and/or may affect your app’s visibility on the Play Store.
Please try updating your app with an updated version of this library, or remove it from your app.
To suppress this error, use the issue id "OutdatedLibrary" as explained in the Suppressing Warnings and Errors section.
Please try updating your app with an updated version of this library, or remove it from your app.
To suppress this error, use the issue id "OutdatedLibrary" as explained in the Suppressing Warnings and Errors section.
Overdraw
Disabled By: Project lint.xml file
If you set a background drawable on a root view, then you should use a custom theme where the theme background is null. Otherwise, the theme background will be painted first, only to have your custom background completely cover it; this is called "overdraw".
NOTE: This detector relies on figuring out which layouts are associated with which activities based on scanning the Java code, and it's currently doing that using an inexact pattern matching algorithm. Therefore, it can incorrectly conclude which activity the layout is associated with and then wrongly complain that a background-theme is hidden.
If you want your custom background on multiple pages, then you should consider making a custom theme with your custom background and just using that theme instead of a root element background.
Of course it's possible that your custom drawable is translucent and you want it to be mixed with the background. However, you will get better performance if you pre-mix the background with your drawable and use that resulting image or color as a custom theme background instead.
To suppress this error, use the issue id "Overdraw" as explained in the Suppressing Warnings and Errors section.
NOTE: This detector relies on figuring out which layouts are associated with which activities based on scanning the Java code, and it's currently doing that using an inexact pattern matching algorithm. Therefore, it can incorrectly conclude which activity the layout is associated with and then wrongly complain that a background-theme is hidden.
If you want your custom background on multiple pages, then you should consider making a custom theme with your custom background and just using that theme instead of a root element background.
Of course it's possible that your custom drawable is translucent and you want it to be mixed with the background. However, you will get better performance if you pre-mix the background with your drawable and use that resulting image or color as a custom theme background instead.
To suppress this error, use the issue id "Overdraw" as explained in the Suppressing Warnings and Errors section.
Override
Disabled By: Project lint.xml file
Suppose you are building against Android API 8, and you've subclassed Activity. In your subclass you add a new method called
The above scenario is what this lint detector looks for. The above example is real, since
To fix this, either rename your method, or if you are really trying to augment the builtin method if available, switch to a higher build target where you can deliberately add
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "Override" as explained in the Suppressing Warnings and Errors section.
isDestroyed
(). At some later point, a method of the same name and signature is added to Android. Your method will now override the Android method, and possibly break its contract. Your method is not calling super.isDestroyed()
, since your compilation target doesn't know about the method.The above scenario is what this lint detector looks for. The above example is real, since
isDestroyed()
was added in API 17, but it will be true for any method you have added to a subclass of an Android class where your build target is lower than the version the method was introduced in.To fix this, either rename your method, or if you are really trying to augment the builtin method if available, switch to a higher build target where you can deliberately add
@Override
on your overriding method, and call super
if appropriate etc.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "Override" as explained in the Suppressing Warnings and Errors section.
OverrideAbstract
Disabled By: Project lint.xml file
To improve the usability of some APIs, some methods that used to be
However, if your code is also targeting older versions of the platform where these methods were still
To suppress this error, use the issue id "OverrideAbstract" as explained in the Suppressing Warnings and Errors section.
abstract
have been made concrete by adding default implementations. This means that when compiling with new versions of the SDK, your code does not have to override these methods.However, if your code is also targeting older versions of the platform where these methods were still
abstract
, the code will crash. You must override all methods that used to be abstract in any versions targeted by your application's minSdkVersion
.To suppress this error, use the issue id "OverrideAbstract" as explained in the Suppressing Warnings and Errors section.
PackageManagerGetSignatures
Disabled By: Project lint.xml file
Improper validation of app signatures could lead to issues where a malicious app submits itself to the Play Store with both its real certificate and a fake certificate and gains access to functionality or information it shouldn't have due to another application only checking for the fake certificate and ignoring the rest. Please make sure to validate all signatures returned by this method.
To suppress this error, use the issue id "PackageManagerGetSignatures" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "PackageManagerGetSignatures" as explained in the Suppressing Warnings and Errors section.
ParcelClassLoader
Disabled By: Project lint.xml file
The documentation for
If you are writing your own classes into the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ParcelClassLoader" as explained in the Suppressing Warnings and Errors section.
Parcel#readParcelable(ClassLoader)
(and its variations) says that you can pass in null
to pick up the default class loader. However, that ClassLoader is a system class loader and is not able to find classes in your own application.If you are writing your own classes into the
Parcel
(not just SDK classes like String
and so on), then you should supply a ClassLoader
for your application instead; a simple way to obtain one is to just call getClass().getClassLoader()
from your own class.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ParcelClassLoader" as explained in the Suppressing Warnings and Errors section.
ParcelCreator
Disabled By: Project lint.xml file
According to the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ParcelCreator" as explained in the Suppressing Warnings and Errors section.
Parcelable
interface documentation, "Classes implementing the Parcelable interface must also have a static field called CREATOR
, which is an object implementing the Parcelable.Creator
interface."Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ParcelCreator" as explained in the Suppressing Warnings and Errors section.
PendingBindings
Disabled By: Project lint.xml file
When using a
To suppress this error, use the issue id "PendingBindings" as explained in the Suppressing Warnings and Errors section.
ViewDataBinding
in a onBindViewHolder
method, you must call executePendingBindings()
before the method exits; otherwise the data binding runtime will update the UI in the next animation frame causing a delayed update and potential jumps if the item resizes.To suppress this error, use the issue id "PendingBindings" as explained in the Suppressing Warnings and Errors section.
PermissionImpliesUnsupportedChromeOsHardware
Disabled By: Default
The
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "PermissionImpliesUnsupportedChromeOsHardware" as explained in the Suppressing Warnings and Errors section.
<uses-permission>
element should not require a permission that implies an unsupported Chrome OS hardware feature. Google Play assumes that certain hardware related permissions indicate that the underlying hardware features are required by default. To fix the issue, consider declaring the corresponding uses-feature element with required="false"
attribute.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "PermissionImpliesUnsupportedChromeOsHardware" as explained in the Suppressing Warnings and Errors section.
PermissionImpliesUnsupportedHardware
Disabled By: Project lint.xml file
The <uses-permission> element should not require a permission that implies an unsupported TV hardware feature. Google Play assumes that certain hardware related permissions indicate that the underlying hardware features are required by default. To fix the issue, consider declaring the corresponding uses-feature element with required="false" attribute.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "PermissionImpliesUnsupportedHardware" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "PermissionImpliesUnsupportedHardware" as explained in the Suppressing Warnings and Errors section.
PinSetExpiry
Disabled By: Project lint.xml file
Ensures that the
To suppress this error, use the issue id "PinSetExpiry" as explained in the Suppressing Warnings and Errors section.
expiration
attribute of the <pin-set>
element is valid and has not already expired or is expiring soonTo suppress this error, use the issue id "PinSetExpiry" as explained in the Suppressing Warnings and Errors section.
PluralsCandidate
Disabled By: Project lint.xml file
This lint check looks for potential errors in internationalization where you have translated a message which involves a quantity and it looks like other parts of the string may need grammatical changes.
For example, rather than something like this:
<string name="try_again">Try again in %d seconds.</string>
you should be using a plural:
<plurals name="try_again">
<item quantity="one">Try again in %d second</item>
<item quantity="other">Try again in %d seconds</item>
</plurals>
This will ensure that in other languages the right set of translations are provided for the different quantity classes.
(This check depends on some heuristics, so it may not accurately determine whether a string really should be a quantity. You can use tools:ignore to filter out false positives.
To suppress this error, use the issue id "PluralsCandidate" as explained in the Suppressing Warnings and Errors section.
For example, rather than something like this:
<string name="try_again">Try again in %d seconds.</string>
you should be using a plural:
<plurals name="try_again">
<item quantity="one">Try again in %d second</item>
<item quantity="other">Try again in %d seconds</item>
</plurals>
This will ensure that in other languages the right set of translations are provided for the different quantity classes.
(This check depends on some heuristics, so it may not accurately determine whether a string really should be a quantity. You can use tools:ignore to filter out false positives.
To suppress this error, use the issue id "PluralsCandidate" as explained in the Suppressing Warnings and Errors section.
PrivateApi
Disabled By: Project lint.xml file
Using reflection to access hidden/private Android APIs is not safe; it will often not work on devices from other vendors, and it may suddenly stop working (if the API is removed) or crash spectacularly (if the API behavior changes, since there are no guarantees for compatibility).
To suppress this error, use the issue id "PrivateApi" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "PrivateApi" as explained in the Suppressing Warnings and Errors section.
PrivateResource
Disabled By: Project lint.xml file
Private resources should not be referenced; the may not be present everywhere, and even where they are they may disappear without notice.
To fix this, copy the resource into your own project instead.
To suppress this error, use the issue id "PrivateResource" as explained in the Suppressing Warnings and Errors section.
To fix this, copy the resource into your own project instead.
To suppress this error, use the issue id "PrivateResource" as explained in the Suppressing Warnings and Errors section.
ProguardSplit
Disabled By: Project lint.xml file
Earlier versions of the Android tools bundled a single
In the new version of the tools, we have split the ProGuard configuration into two halves:
* A simple configuration file containing only project-specific flags, in your project
* A generic configuration file containing the recommended set of ProGuard options for Android projects. This generic file lives in the SDK install directory which means that it gets updated along with the tools.
In order for this to work, the proguard.config property in the
To migrate your project to the new setup, create a new
To suppress this error, use the issue id "ProguardSplit" as explained in the Suppressing Warnings and Errors section.
proguard.cfg
file containing a ProGuard configuration file suitable for Android shrinking and obfuscation. However, that version was copied into new projects, which means that it does not continue to get updated as we improve the default ProGuard rules for Android.In the new version of the tools, we have split the ProGuard configuration into two halves:
* A simple configuration file containing only project-specific flags, in your project
* A generic configuration file containing the recommended set of ProGuard options for Android projects. This generic file lives in the SDK install directory which means that it gets updated along with the tools.
In order for this to work, the proguard.config property in the
project.properties
file now refers to a path, so you can reference both the generic file as well as your own (and any additional files too).To migrate your project to the new setup, create a new
proguard-project.txt
file in your project containing any project specific ProGuard flags as well as any customizations you have made, then update your project.properties file to contain:proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
To suppress this error, use the issue id "ProguardSplit" as explained in the Suppressing Warnings and Errors section.
PropertyEscape
Disabled By: Project lint.xml file
All backslashes and colons in .property files must be escaped with a backslash (). This means that when writing a Windows path, you must escape the file separators, so the path MyFiles should be written as
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "PropertyEscape" as explained in the Suppressing Warnings and Errors section.
key=\\My\\Files.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "PropertyEscape" as explained in the Suppressing Warnings and Errors section.
ProtectedPermissions
Disabled By: Project lint.xml file
Permissions with the protection level signature, privileged or signatureOrSystem are only granted to system apps. If an app is a regular non-system app, it will never be able to use these permissions.
To suppress this error, use the issue id "ProtectedPermissions" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "ProtectedPermissions" as explained in the Suppressing Warnings and Errors section.
ProxyPassword
Disabled By: Project lint.xml file
Storing proxy server passwords in clear text is dangerous if this file is shared via version control. If this is deliberate or this is a truly private project, suppress this warning.
To suppress this error, use the issue id "ProxyPassword" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "ProxyPassword" as explained in the Suppressing Warnings and Errors section.
PxUsage
Disabled By: Project lint.xml file
For performance reasons and to keep the code simpler, the Android system uses pixels as the standard unit for expressing dimension or coordinate values. That means that the dimensions of a view are always expressed in the code using pixels, but always based on the current screen density. For instance, if
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "PxUsage" as explained in the Suppressing Warnings and Errors section.
myView.getWidth()
returns 10, the view is 10 pixels wide on the current screen, but on a device with a higher density screen, the value returned might be 15. If you use pixel values in your application code to work with bitmaps that are not pre-scaled for the current screen density, you might need to scale the pixel values that you use in your code to match the un-scaled bitmap source.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "PxUsage" as explained in the Suppressing Warnings and Errors section.
Range
Disabled By: Project lint.xml file
Some parameters are required to in a particular numerical range; this check makes sure that arguments passed fall within the range. For arrays, Strings and collections this refers to the size or length.
To suppress this error, use the issue id "Range" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "Range" as explained in the Suppressing Warnings and Errors section.
Recycle
Disabled By: Project lint.xml file
Many resources, such as TypedArrays, VelocityTrackers, etc., should be recycled (with a
To suppress this error, use the issue id "Recycle" as explained in the Suppressing Warnings and Errors section.
recycle()
call) after use. This lint check looks for missing recycle()
calls.To suppress this error, use the issue id "Recycle" as explained in the Suppressing Warnings and Errors section.
RecyclerView
Disabled By: Project lint.xml file
For this reason, you should only use the position parameter while acquiring the related data item inside this method, and should not keep a copy of it.
If you need the position of an item later on (e.g. in a click listener), use
To suppress this error, use the issue id "RecyclerView" as explained in the Suppressing Warnings and Errors section.
RecyclerView
will not call onBindViewHolder
again when the position of the item changes in the data set unless the item itself is invalidated or the new position cannot be determined.For this reason, you should only use the position parameter while acquiring the related data item inside this method, and should not keep a copy of it.
If you need the position of an item later on (e.g. in a click listener), use
getAdapterPosition()
which will have the updated adapter position.To suppress this error, use the issue id "RecyclerView" as explained in the Suppressing Warnings and Errors section.
Registered
Disabled By: Default
Activities, services and content providers should be registered in the
If your activity is simply a parent class intended to be subclassed by other "real" activities, make it an abstract class.
To suppress this error, use the issue id "Registered" as explained in the Suppressing Warnings and Errors section.
AndroidManifest.xml
file using <activity>
, <service>
and <provider>
tags.If your activity is simply a parent class intended to be subclassed by other "real" activities, make it an abstract class.
To suppress this error, use the issue id "Registered" as explained in the Suppressing Warnings and Errors section.
RelativeOverlap
Disabled By: Project lint.xml file
If relative layout has text or button items aligned to left and right sides they can overlap each other due to localized text expansion unless they have mutual constraints like
To suppress this error, use the issue id "RelativeOverlap" as explained in the Suppressing Warnings and Errors section.
toEndOf
/toStartOf
.To suppress this error, use the issue id "RelativeOverlap" as explained in the Suppressing Warnings and Errors section.
RequiredSize
Disabled By: Default
All views must specify an explicit
It's possible to specify these widths via styles as well. GridLayout, as a special case, does not require you to specify a size.
To suppress this error, use the issue id "RequiredSize" as explained in the Suppressing Warnings and Errors section.
layout_width
and layout_height
attribute. There is a runtime check for this, so if you fail to specify a size, an exception is thrown at runtime.It's possible to specify these widths via styles as well. GridLayout, as a special case, does not require you to specify a size.
To suppress this error, use the issue id "RequiredSize" as explained in the Suppressing Warnings and Errors section.
RequiresFeature
Disabled By: Project lint.xml file
Some APIs require optional features to be present. This check makes sure that calls to these APIs are surrounded by a check which enforces this.
To suppress this error, use the issue id "RequiresFeature" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "RequiresFeature" as explained in the Suppressing Warnings and Errors section.
ResourceAsColor
Disabled By: Project lint.xml file
Methods that take a color in the form of an integer should be passed an RGB triple, not the actual color resource id. You must call
Similarly, methods that take a dimension integer should be passed an actual dimension (call
To suppress this error, use the issue id "ResourceAsColor" as explained in the Suppressing Warnings and Errors section.
getResources().getColor(resource)
to resolve the actual color value first.Similarly, methods that take a dimension integer should be passed an actual dimension (call
getResources().getDimension(resource)
To suppress this error, use the issue id "ResourceAsColor" as explained in the Suppressing Warnings and Errors section.
ResourceType
Disabled By: Project lint.xml file
Ensures that resource id's passed to APIs are of the right type; for example, calling
To suppress this error, use the issue id "ResourceType" as explained in the Suppressing Warnings and Errors section.
Resources.getColor(R.string.name)
is wrong.To suppress this error, use the issue id "ResourceType" as explained in the Suppressing Warnings and Errors section.
RestrictedApi
Disabled By: Project lint.xml file
This API has been flagged with a restriction that has not been met.
Examples of API restrictions:
* Method can only be invoked by a subclass
* Method can only be accessed from within the same library (defined by the Gradle library group id)
* Method can only be accessed from tests.
You can add your own API restrictions with the
To suppress this error, use the issue id "RestrictedApi" as explained in the Suppressing Warnings and Errors section.
Examples of API restrictions:
* Method can only be invoked by a subclass
* Method can only be accessed from within the same library (defined by the Gradle library group id)
* Method can only be accessed from tests.
You can add your own API restrictions with the
@RestrictTo
annotation.To suppress this error, use the issue id "RestrictedApi" as explained in the Suppressing Warnings and Errors section.
RiskyLibrary
Disabled By: Project lint.xml file
Your app is using a version of a library that has been identified by the library developer as a potential source of privacy and/or security risks. This may be a violation of Google Play policies (see https://play.google.com/about/monetization-ads/ads/) and/or affect your app’s visibility on the Play Store.
When available, the individual error messages from lint will include details about the reasons for this advisory.
Please try updating your app with an updated version of this library, or remove it from your app.
To suppress this error, use the issue id "RiskyLibrary" as explained in the Suppressing Warnings and Errors section.
When available, the individual error messages from lint will include details about the reasons for this advisory.
Please try updating your app with an updated version of this library, or remove it from your app.
To suppress this error, use the issue id "RiskyLibrary" as explained in the Suppressing Warnings and Errors section.
RtlCompat
Disabled By: Project lint.xml file
API 17 adds a
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "RtlCompat" as explained in the Suppressing Warnings and Errors section.
textAlignment
attribute to specify text alignment. However, if you are supporting older versions than API 17, you must also specify a gravity or layout_gravity attribute, since older platforms will ignore the textAlignment
attribute.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "RtlCompat" as explained in the Suppressing Warnings and Errors section.
RtlEnabled
Disabled By: Project lint.xml file
To enable right-to-left support, when running on API 17 and higher, you must set the
If you have started adding RTL attributes, but have not yet finished the migration, you can set the attribute to false to satisfy this lint check.
To suppress this error, use the issue id "RtlEnabled" as explained in the Suppressing Warnings and Errors section.
android:supportsRtl
attribute in the manifest <application>
element.If you have started adding RTL attributes, but have not yet finished the migration, you can set the attribute to false to satisfy this lint check.
To suppress this error, use the issue id "RtlEnabled" as explained in the Suppressing Warnings and Errors section.
RtlHardcoded
Disabled By: Project lint.xml file
Using
For XML attributes such as paddingLeft and
(Note: For
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "RtlHardcoded" as explained in the Suppressing Warnings and Errors section.
Gravity#LEFT
and Gravity#RIGHT
can lead to problems when a layout is rendered in locales where text flows from right to left. Use Gravity#START
and Gravity#END
instead. Similarly, in XML gravity
and layout_gravity
attributes, use start
rather than left
.For XML attributes such as paddingLeft and
layout_marginLeft
, use paddingStart
and layout_marginStart
. NOTE: If your minSdkVersion
is less than 17, you should add both the older left/right attributes as well as the new start/right attributes. On older platforms, where RTL is not supported and the start/right attributes are unknown and therefore ignored, you need the older left/right attributes. There is a separate lint check which catches that type of error.(Note: For
Gravity#LEFT
and Gravity#START
, you can use these constants even when targeting older platforms, because the start
bitmask is a superset of the left
bitmask. Therefore, you can use gravity="start"
rather than gravity="left|start"
.)Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "RtlHardcoded" as explained in the Suppressing Warnings and Errors section.
RtlSymmetry
Disabled By: Project lint.xml file
If you specify padding or margin on the left side of a layout, you should probably also specify padding on the right side (and vice versa) for right-to-left layout symmetry.
To suppress this error, use the issue id "RtlSymmetry" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "RtlSymmetry" as explained in the Suppressing Warnings and Errors section.
SQLiteString
Disabled By: Project lint.xml file
In SQLite, any column can store any data type; the declared type for a column is more of a hint as to what the data should be cast to when stored.
There are many ways to store a string.
If you try to store a value in a numeric column, SQLite will try to cast it to a float or an integer before storing. If it can't, it will just store it as a string.
This can lead to some subtle bugs. For example, when SQLite encounters a string like
To fix this, you can change your schema to use a
There are many ways to store a string.
TEXT
, VARCHAR
, CHARACTER
and CLOB
are string types, but `STRING` is not. Columns defined as STRING are actually numeric.If you try to store a value in a numeric column, SQLite will try to cast it to a float or an integer before storing. If it can't, it will just store it as a string.
This can lead to some subtle bugs. For example, when SQLite encounters a string like
1234567e1234
, it will parse it as a float, but the result will be out of range for floating point numbers, so Inf
will be stored! Similarly, strings that look like integers will lose leading zeroes.To fix this, you can change your schema to use a
TEXT
type instead.More info: https://www.sqlite.org/datatype3.html
To suppress this error, use the issue id "SQLiteString" as explained in the Suppressing Warnings and Errors section.SSLCertificateSocketFactoryCreateSocket
Disabled By: Project lint.xml file
When
To suppress this error, use the issue id "SSLCertificateSocketFactoryCreateSocket" as explained in the Suppressing Warnings and Errors section.
SSLCertificateSocketFactory.createSocket()
is called with an InetAddress
as the first parameter, TLS/SSL hostname verification is not performed, which could result in insecure network traffic caused by trusting arbitrary hostnames in TLS/SSL certificates presented by peers. In this case, developers must ensure that the InetAddress
is explicitly verified against the certificate through other means, such as by calling `SSLCertificateSocketFactory.getDefaultHostnameVerifier() to get a HostnameVerifier
and calling HostnameVerifier.verify()
.To suppress this error, use the issue id "SSLCertificateSocketFactoryCreateSocket" as explained in the Suppressing Warnings and Errors section.
SSLCertificateSocketFactoryGetInsecure
Disabled By: Project lint.xml file
The
To suppress this error, use the issue id "SSLCertificateSocketFactoryGetInsecure" as explained in the Suppressing Warnings and Errors section.
SSLCertificateSocketFactory.getInsecure()
method returns an SSLSocketFactory with all TLS/SSL security checks disabled, which could result in insecure network traffic caused by trusting arbitrary TLS/SSL certificates presented by peers. This method should be avoided unless needed for a special circumstance such as debugging. Instead, SSLCertificateSocketFactory.getDefault()
should be used.To suppress this error, use the issue id "SSLCertificateSocketFactoryGetInsecure" as explained in the Suppressing Warnings and Errors section.
ScrollViewCount
Disabled By: Project lint.xml file
ScrollViews can only have one child widget. If you want more children, wrap them in a container layout.
To suppress this error, use the issue id "ScrollViewCount" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "ScrollViewCount" as explained in the Suppressing Warnings and Errors section.
ScrollViewSize
Disabled By: Project lint.xml file
ScrollView children must set their
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ScrollViewSize" as explained in the Suppressing Warnings and Errors section.
layout_width
or layout_height
attributes to wrap_content
rather than fill_parent
or match_parent
in the scrolling dimensionNote: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ScrollViewSize" as explained in the Suppressing Warnings and Errors section.
SdCardPath
Disabled By: Project lint.xml file
Your code should not reference the
Similarly, do not reference the
To suppress this error, use the issue id "SdCardPath" as explained in the Suppressing Warnings and Errors section.
/sdcard
path directly; instead use Environment.getExternalStorageDirectory().getPath()
.Similarly, do not reference the
/data/data/
path directly; it can vary in multi-user scenarios. Instead, use Context.getFilesDir().getPath()
.To suppress this error, use the issue id "SdCardPath" as explained in the Suppressing Warnings and Errors section.
SecureRandom
Disabled By: Project lint.xml file
Specifying a fixed seed will cause the instance to return a predictable sequence of numbers. This may be useful for testing but it is not appropriate for secure use.
To suppress this error, use the issue id "SecureRandom" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "SecureRandom" as explained in the Suppressing Warnings and Errors section.
SelectableText
Disabled By: Default
If a
This lint check looks for TextViews which are likely to be displaying data: views whose text is set dynamically. This value will be ignored on platforms older than API 11, so it is okay to set it regardless of your
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "SelectableText" as explained in the Suppressing Warnings and Errors section.
<TextView>
is used to display data, the user might want to copy that data and paste it elsewhere. To allow this, the <TextView>
should specify android:textIsSelectable="true"
.This lint check looks for TextViews which are likely to be displaying data: views whose text is set dynamically. This value will be ignored on platforms older than API 11, so it is okay to set it regardless of your
minSdkVersion
.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "SelectableText" as explained in the Suppressing Warnings and Errors section.
ServiceCast
Disabled By: Project lint.xml file
When you call
To suppress this error, use the issue id "ServiceCast" as explained in the Suppressing Warnings and Errors section.
Context#getSystemService()
, the result is typically cast to a specific interface. This lint check ensures that the cast is compatible with the expected type of the return value.To suppress this error, use the issue id "ServiceCast" as explained in the Suppressing Warnings and Errors section.
SetJavaScriptEnabled
Disabled By: Project lint.xml file
Your code should not invoke
To suppress this error, use the issue id "SetJavaScriptEnabled" as explained in the Suppressing Warnings and Errors section.
setJavaScriptEnabled
if you are not sure that your app really requires JavaScript support.To suppress this error, use the issue id "SetJavaScriptEnabled" as explained in the Suppressing Warnings and Errors section.
SetTextI18n
Disabled By: Project lint.xml file
When calling
* Never call
* Do not pass a string literal (e.g. "Hello") to display text. Hardcoded text can not be properly translated to other languages. Consider using Android resource strings instead.
* Do not build messages by concatenating text chunks. Such messages can not be properly translated.
To suppress this error, use the issue id "SetTextI18n" as explained in the Suppressing Warnings and Errors section.
TextView#setText
* Never call
Number#toString()
to format numbers; it will not handle fraction separators and locale-specific digits properly. Consider using String#format
with proper format specifications (%d
or %f
) instead.* Do not pass a string literal (e.g. "Hello") to display text. Hardcoded text can not be properly translated to other languages. Consider using Android resource strings instead.
* Do not build messages by concatenating text chunks. Such messages can not be properly translated.
To suppress this error, use the issue id "SetTextI18n" as explained in the Suppressing Warnings and Errors section.
SetWorldReadable
Disabled By: Project lint.xml file
Setting files world-readable is very dangerous, and likely to cause security holes in applications. It is strongly discouraged; instead, applications should use more formal mechanisms for interactions such as
To suppress this error, use the issue id "SetWorldReadable" as explained in the Suppressing Warnings and Errors section.
ContentProvider
, BroadcastReceiver
, and Service
.To suppress this error, use the issue id "SetWorldReadable" as explained in the Suppressing Warnings and Errors section.
SetWorldWritable
Disabled By: Project lint.xml file
Setting files world-writable is very dangerous, and likely to cause security holes in applications. It is strongly discouraged; instead, applications should use more formal mechanisms for interactions such as
To suppress this error, use the issue id "SetWorldWritable" as explained in the Suppressing Warnings and Errors section.
ContentProvider
, BroadcastReceiver
, and Service
.To suppress this error, use the issue id "SetWorldWritable" as explained in the Suppressing Warnings and Errors section.
ShiftFlags
Disabled By: Project lint.xml file
When defining multiple constants for use in flags, the recommended style is to use the form
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ShiftFlags" as explained in the Suppressing Warnings and Errors section.
1 << 2
, 1 << 3
, 1 << 4
and so on to ensure that the constants are unique and non-overlapping.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ShiftFlags" as explained in the Suppressing Warnings and Errors section.
ShortAlarm
Disabled By: Project lint.xml file
Frequent alarms are bad for battery life. As of API 22, the
If you really need to do work sooner than 5 seconds, post a delayed message or runnable to a Handler.
To suppress this error, use the issue id "ShortAlarm" as explained in the Suppressing Warnings and Errors section.
AlarmManager
will override near-future and high-frequency alarm requests, delaying the alarm at least 5 seconds into the future and ensuring that the repeat interval is at least 60 seconds.If you really need to do work sooner than 5 seconds, post a delayed message or runnable to a Handler.
To suppress this error, use the issue id "ShortAlarm" as explained in the Suppressing Warnings and Errors section.
ShowToast
Disabled By: Project lint.xml file
To suppress this error, use the issue id "ShowToast" as explained in the Suppressing Warnings and Errors section.
Toast.makeText()
creates a Toast
but does not show it. You must call show()
on the resulting object to actually make the Toast
appear.To suppress this error, use the issue id "ShowToast" as explained in the Suppressing Warnings and Errors section.
SignatureOrSystemPermissions
Disabled By: Project lint.xml file
The
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "SignatureOrSystemPermissions" as explained in the Suppressing Warnings and Errors section.
signature
protection level should probably be sufficient for most needs and works regardless of where applications are installed. The signatureOrSystem
level is used for certain situations where multiple vendors have applications built into a system image and need to share specific features explicitly because they are being built together.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "SignatureOrSystemPermissions" as explained in the Suppressing Warnings and Errors section.
SimpleDateFormat
Disabled By: Project lint.xml file
Almost all callers should use
Therefore, you should either use the form of the SimpleDateFormat constructor where you pass in an explicit locale, such as Locale.US, or use one of the get instance methods, or suppress this error if really know what you are doing.
To suppress this error, use the issue id "SimpleDateFormat" as explained in the Suppressing Warnings and Errors section.
getDateInstance()
, getDateTimeInstance()
, or getTimeInstance()
to get a ready-made instance of SimpleDateFormat suitable for the user's locale. The main reason you'd create an instance this class directly is because you need to format/parse a specific machine-readable format, in which case you almost certainly want to explicitly ask for US to ensure that you get ASCII digits (rather than, say, Arabic digits).Therefore, you should either use the form of the SimpleDateFormat constructor where you pass in an explicit locale, such as Locale.US, or use one of the get instance methods, or suppress this error if really know what you are doing.
To suppress this error, use the issue id "SimpleDateFormat" as explained in the Suppressing Warnings and Errors section.
Slices
Disabled By: Project lint.xml file
This check analyzes usages of the Slices API and offers suggestions based
on best practices.
To suppress this error, use the issue id "Slices" as explained in the Suppressing Warnings and Errors section.
on best practices.
To suppress this error, use the issue id "Slices" as explained in the Suppressing Warnings and Errors section.
SmallSp
Disabled By: Project lint.xml file
Avoid using sizes smaller than 12sp.
To suppress this error, use the issue id "SmallSp" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "SmallSp" as explained in the Suppressing Warnings and Errors section.
SpUsage
Disabled By: Project lint.xml file
When setting text sizes, you should normally use
There are cases where you might need to use
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "SpUsage" as explained in the Suppressing Warnings and Errors section.
sp
, or "scale-independent pixels". This is like the dp
unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and the user's preference.There are cases where you might need to use
dp
; typically this happens when the text is in a container with a specific dp-size. This will prevent the text from spilling outside the container. Note however that this means that the user's font size settings are not respected, so consider adjusting the layout itself to be more flexible.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "SpUsage" as explained in the Suppressing Warnings and Errors section.
StateListReachable
Disabled By: Project lint.xml file
In a selector, only the last child in the state list should omit a state qualifier. If not, all subsequent items in the list will be ignored since the given item will match all.
To suppress this error, use the issue id "StateListReachable" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "StateListReachable" as explained in the Suppressing Warnings and Errors section.
StaticFieldLeak
Disabled By: Project lint.xml file
A static field will leak contexts.
Non-static inner classes have an implicit reference to their outer class. If that outer class is for example a
Similarly, direct field references to activities and fragments from these longer running instances can cause leaks.
ViewModel classes should never point to Views or non-application Contexts.
To suppress this error, use the issue id "StaticFieldLeak" as explained in the Suppressing Warnings and Errors section.
Non-static inner classes have an implicit reference to their outer class. If that outer class is for example a
Fragment
or Activity
, then this reference means that the long-running handler/loader/task will hold a reference to the activity which prevents it from getting garbage collected.Similarly, direct field references to activities and fragments from these longer running instances can cause leaks.
ViewModel classes should never point to Views or non-application Contexts.
To suppress this error, use the issue id "StaticFieldLeak" as explained in the Suppressing Warnings and Errors section.
StopShip
Disabled By: Default
Using the comment
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "StopShip" as explained in the Suppressing Warnings and Errors section.
// STOPSHIP
can be used to flag code that is incomplete but checked in. This comment marker can be used to indicate that the code should not be shipped until the issue is addressed, and lint will look for these. In Gradle projects, this is only checked for non-debug (release) builds.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "StopShip" as explained in the Suppressing Warnings and Errors section.
StringEscaping
Disabled By: Project lint.xml file
Apostrophes (') must always be escaped (with a \), unless they appear in a string which is itself escaped in double quotes (").
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "StringEscaping" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "StringEscaping" as explained in the Suppressing Warnings and Errors section.
StringFormatCount
Disabled By: Project lint.xml file
When a formatted string takes arguments, it usually needs to reference the same arguments in all translations (or all arguments if there are no translations.
There are cases where this is not the case, so this issue is a warning rather than an error by default. However, this usually happens when a language is not translated or updated correctly.
To suppress this error, use the issue id "StringFormatCount" as explained in the Suppressing Warnings and Errors section.
There are cases where this is not the case, so this issue is a warning rather than an error by default. However, this usually happens when a language is not translated or updated correctly.
To suppress this error, use the issue id "StringFormatCount" as explained in the Suppressing Warnings and Errors section.
StringFormatInvalid
Disabled By: Project lint.xml file
If a string contains a '%' character, then the string may be a formatting string which will be passed to
This lint warning checks for two related problems:
(1) Formatting strings that are invalid, meaning that
(2) Strings containing '%' that are not formatting strings getting passed to a
NOTE: Not all Strings which look like formatting strings are intended for use by
To suppress this error, use the issue id "StringFormatInvalid" as explained in the Suppressing Warnings and Errors section.
String.format
from Java code to replace each '%' occurrence with specific values.This lint warning checks for two related problems:
(1) Formatting strings that are invalid, meaning that
String.format
will throw exceptions at runtime when attempting to use the format string.(2) Strings containing '%' that are not formatting strings getting passed to a
String.format
call. In this case the '%' will need to be escaped as '%%'.NOTE: Not all Strings which look like formatting strings are intended for use by
String.format
; for example, they may contain date formats intended for android.text.format.Time#format()
. Lint cannot always figure out that a String is a date format, so you may get false warnings in those scenarios. See the suppress help topic for information on how to suppress errors in that case.To suppress this error, use the issue id "StringFormatInvalid" as explained in the Suppressing Warnings and Errors section.
StringFormatMatches
Disabled By: Project lint.xml file
This lint check ensures the following:
(1) If there are multiple translations of the format string, then all translations use the same type for the same numbered arguments
(2) The usage of the format string in Java is consistent with the format string, meaning that the parameter types passed to String.format matches those in the format string.
To suppress this error, use the issue id "StringFormatMatches" as explained in the Suppressing Warnings and Errors section.
(1) If there are multiple translations of the format string, then all translations use the same type for the same numbered arguments
(2) The usage of the format string in Java is consistent with the format string, meaning that the parameter types passed to String.format matches those in the format string.
To suppress this error, use the issue id "StringFormatMatches" as explained in the Suppressing Warnings and Errors section.
StringShouldBeInt
Disabled By: Project lint.xml file
The properties
However, you can not use a number as a string (e.g. "19" instead of 19); that will result in a platform not found error message at build/sync time.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "StringShouldBeInt" as explained in the Suppressing Warnings and Errors section.
compileSdkVersion
, minSdkVersion
and targetSdkVersion
are usually numbers, but can be strings when you are using an add-on (in the case of compileSdkVersion
) or a preview platform (for the other two properties).However, you can not use a number as a string (e.g. "19" instead of 19); that will result in a platform not found error message at build/sync time.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "StringShouldBeInt" as explained in the Suppressing Warnings and Errors section.
SupportAnnotationUsage
Disabled By: Project lint.xml file
This lint check makes sure that the support annotations (such as
To suppress this error, use the issue id "SupportAnnotationUsage" as explained in the Suppressing Warnings and Errors section.
@IntDef
and @ColorInt
) are used correctly. For example, it's an error to specify an @IntRange
where the from
value is higher than the to
value.To suppress this error, use the issue id "SupportAnnotationUsage" as explained in the Suppressing Warnings and Errors section.
Suspicious0dp
Disabled By: Project lint.xml file
Using 0dp as the width in a horizontal LinearLayout with weights is a useful trick to ensure that only the weights (and not the intrinsic sizes) are used when sizing the children.
However, if you use 0dp for the opposite dimension, the view will be invisible. This can happen if you change the orientation of a layout without also flipping the 0dp dimension in all the children.
To suppress this error, use the issue id "Suspicious0dp" as explained in the Suppressing Warnings and Errors section.
However, if you use 0dp for the opposite dimension, the view will be invisible. This can happen if you change the orientation of a layout without also flipping the 0dp dimension in all the children.
To suppress this error, use the issue id "Suspicious0dp" as explained in the Suppressing Warnings and Errors section.
SuspiciousImport
Disabled By: Project lint.xml file
Importing
Once the import is there you might get a lot of "confusing" error messages because of course the fields available on
To suppress this error, use the issue id "SuspiciousImport" as explained in the Suppressing Warnings and Errors section.
android.R
is usually not intentional; it sometimes happens when you use an IDE and ask it to automatically add imports at a time when your project's R class it not present.Once the import is there you might get a lot of "confusing" error messages because of course the fields available on
android.R
are not the ones you'd expect from just looking at your own R
class.To suppress this error, use the issue id "SuspiciousImport" as explained in the Suppressing Warnings and Errors section.
SwitchIntDef
Disabled By: Project lint.xml file
This check warns if a
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "SwitchIntDef" as explained in the Suppressing Warnings and Errors section.
switch
statement does not explicitly include all the values declared by the typedef @IntDef
declaration.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "SwitchIntDef" as explained in the Suppressing Warnings and Errors section.
SyntheticAccessor
Disabled By: Default
A private inner class which is accessed from the outer class will force the compiler to insert a synthetic accessor; this means that you are causing extra overhead. This is not important in small projects, but is important for large apps running up against the 64K method handle limit, and especially for libraries where you want to make sure your library is as small as possible for the cases where your library is used in an app running up against the 64K limit.
To suppress this error, use the issue id "SyntheticAccessor" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "SyntheticAccessor" as explained in the Suppressing Warnings and Errors section.
TextFields
Disabled By: Project lint.xml file
Providing an
The lint detector also looks at the
If you really want to keep the text field generic, you can suppress this warning by setting
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "TextFields" as explained in the Suppressing Warnings and Errors section.
inputType
attribute on a text field improves usability because depending on the data to be input, optimized keyboards can be shown to the user (such as just digits and parentheses for a phone number). The lint detector also looks at the
id
of the view, and if the id offers a hint of the purpose of the field (for example, the id
contains the phrase phone
or email
), then lint will also ensure that the inputType
contains the corresponding type attributes.If you really want to keep the text field generic, you can suppress this warning by setting
inputType="text"
.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "TextFields" as explained in the Suppressing Warnings and Errors section.
TextViewEdits
Disabled By: Project lint.xml file
Using a
This check also checks subclasses of
To suppress this error, use the issue id "TextViewEdits" as explained in the Suppressing Warnings and Errors section.
<TextView>
to input text is generally an error, you should be using <EditText>
instead. EditText
is a subclass of TextView
, and some of the editing support is provided by TextView
, so it's possible to set some input-related properties on a TextView
. However, using a TextView
along with input attributes is usually a cut & paste error. To input text you should be using <EditText>
.This check also checks subclasses of
TextView
, such as Button
and CheckBox
, since these have the same issue: they should not be used with editable attributes.To suppress this error, use the issue id "TextViewEdits" as explained in the Suppressing Warnings and Errors section.
TooDeepLayout
Disabled By: Project lint.xml file
Layouts with too much nesting is bad for performance. Consider using a flatter layout (such as
To suppress this error, use the issue id "TooDeepLayout" as explained in the Suppressing Warnings and Errors section.
RelativeLayout
or GridLayout
).The default maximum depth is 10 but can be configured with the environment variable ANDROID_LINT_MAX_DEPTH
.To suppress this error, use the issue id "TooDeepLayout" as explained in the Suppressing Warnings and Errors section.
TooManyViews
Disabled By: Project lint.xml file
Using too many views in a single layout is bad for performance. Consider using compound drawables or other tricks for reducing the number of views in this layout.
The maximum view count defaults to 80 but can be configured with the environment variable
To suppress this error, use the issue id "TooManyViews" as explained in the Suppressing Warnings and Errors section.
The maximum view count defaults to 80 but can be configured with the environment variable
ANDROID_LINT_MAX_VIEW_COUNT
.To suppress this error, use the issue id "TooManyViews" as explained in the Suppressing Warnings and Errors section.
TranslucentOrientation
Disabled By: Project lint.xml file
Specifying a fixed screen orientation with a translucent theme isn't supported on apps with targetSdkVersion O or greater since there can be an another activity visible behind your activity with a conflicting request.
For example, your activity requests landscape and the visible activity behind your translucent activity request portrait. In this case the system can only honor one of the requests and currently prefers to honor the request from non-translucent activities since there is nothing visible behind them.
Devices running platform version O or greater will throw an exception in your app if this state is detected.
To suppress this error, use the issue id "TranslucentOrientation" as explained in the Suppressing Warnings and Errors section.
For example, your activity requests landscape and the visible activity behind your translucent activity request portrait. In this case the system can only honor one of the requests and currently prefers to honor the request from non-translucent activities since there is nothing visible behind them.
Devices running platform version O or greater will throw an exception in your app if this state is detected.
To suppress this error, use the issue id "TranslucentOrientation" as explained in the Suppressing Warnings and Errors section.
TrulyRandom
Disabled By: Project lint.xml file
Key generation, signing, encryption, and random number generation may not receive cryptographically strong values due to improper initialization of the underlying PRNG on Android 4.3 and below.
If your application relies on cryptographically secure random number generation you should apply the workaround described in https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.html .
This lint rule is mostly informational; it does not accurately detect whether cryptographically secure RNG is required, or whether the workaround has already been applied. After reading the blog entry and updating your code if necessary, you can disable this lint issue.
To suppress this error, use the issue id "TrulyRandom" as explained in the Suppressing Warnings and Errors section.
If your application relies on cryptographically secure random number generation you should apply the workaround described in https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.html .
This lint rule is mostly informational; it does not accurately detect whether cryptographically secure RNG is required, or whether the workaround has already been applied. After reading the blog entry and updating your code if necessary, you can disable this lint issue.
To suppress this error, use the issue id "TrulyRandom" as explained in the Suppressing Warnings and Errors section.
TrustAllX509TrustManager
Disabled By: Project lint.xml file
This check looks for X509TrustManager implementations whose
To suppress this error, use the issue id "TrustAllX509TrustManager" as explained in the Suppressing Warnings and Errors section.
checkServerTrusted
or checkClientTrusted
methods do nothing (thus trusting any certificate chain) which could result in insecure network traffic caused by trusting arbitrary TLS/SSL certificates presented by peers.To suppress this error, use the issue id "TrustAllX509TrustManager" as explained in the Suppressing Warnings and Errors section.
TypographyDashes
Disabled By: Project lint.xml file
The "n dash" (–, –) and the "m dash" (—, —) characters are used for ranges (n dash) and breaks (m dash). Using these instead of plain hyphens can make text easier to read and your application will look more polished.
To suppress this error, use the issue id "TypographyDashes" as explained in the Suppressing Warnings and Errors section.
More info: http://en.wikipedia.org/wiki/Dash
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "TypographyDashes" as explained in the Suppressing Warnings and Errors section.
TypographyEllipsis
Disabled By: Project lint.xml file
You can replace the string "..." with a dedicated ellipsis character, ellipsis character (…, …). This can help make the text more readable.
To suppress this error, use the issue id "TypographyEllipsis" as explained in the Suppressing Warnings and Errors section.
More info: http://en.wikipedia.org/wiki/Ellipsis
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "TypographyEllipsis" as explained in the Suppressing Warnings and Errors section.
TypographyFractions
Disabled By: Project lint.xml file
You can replace certain strings, such as 1/2, and 1/4, with dedicated characters for these, such as ½ (½) and ¼ (¼). This can help make the text more readable.
To suppress this error, use the issue id "TypographyFractions" as explained in the Suppressing Warnings and Errors section.
More info: http://en.wikipedia.org/wiki/Number_Forms
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "TypographyFractions" as explained in the Suppressing Warnings and Errors section.
TypographyOther
Disabled By: Project lint.xml file
This check looks for miscellaneous typographical problems and offers replacement sequences that will make the text easier to read and your application more polished.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "TypographyOther" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "TypographyOther" as explained in the Suppressing Warnings and Errors section.
TypographyQuotes
Disabled By: Default
Straight single quotes and double quotes, when used as a pair, can be replaced by "curvy quotes" (or directional quotes). This can make the text more readable.
Note that you should never use grave accents and apostrophes to quote, `like this'.
(Also note that you should not use curvy quotes for code fragments.)
To suppress this error, use the issue id "TypographyQuotes" as explained in the Suppressing Warnings and Errors section.
Note that you should never use grave accents and apostrophes to quote, `like this'.
(Also note that you should not use curvy quotes for code fragments.)
More info: http://en.wikipedia.org/wiki/Quotation_mark
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "TypographyQuotes" as explained in the Suppressing Warnings and Errors section.
Typos
Disabled By: Project lint.xml file
This check looks through the string definitions, and if it finds any words that look like likely misspellings, they are flagged.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "Typos" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "Typos" as explained in the Suppressing Warnings and Errors section.
UniqueConstants
Disabled By: Project lint.xml file
The
In some cases, the repeated constant is intentional (for example, renaming a constant to a more intuitive name, and leaving the old name in place for compatibility purposes). In that case, simply suppress this check by adding a
To suppress this error, use the issue id "UniqueConstants" as explained in the Suppressing Warnings and Errors section.
@IntDef
annotation allows you to create a light-weight "enum" or type definition. However, it's possible to accidentally specify the same value for two or more of the values, which can lead to hard-to-detect bugs. This check looks for this scenario and flags any repeated constants.In some cases, the repeated constant is intentional (for example, renaming a constant to a more intuitive name, and leaving the old name in place for compatibility purposes). In that case, simply suppress this check by adding a
@SuppressLint("UniqueConstants")
annotation.To suppress this error, use the issue id "UniqueConstants" as explained in the Suppressing Warnings and Errors section.
UnknownIdInLayout
Disabled By: Project lint.xml file
The
This is sometimes intentional, for example where you are referring to a view which is provided in a different layout via an include. However, it is usually an accident where you have a typo or you have renamed a view without updating all the references to it.
To suppress this error, use the issue id "UnknownIdInLayout" as explained in the Suppressing Warnings and Errors section.
@+id/
syntax refers to an existing id, or creates a new one if it has not already been defined elsewhere. However, this means that if you have a typo in your reference, or if the referred view no longer exists, you do not get a warning since the id will be created on demand.This is sometimes intentional, for example where you are referring to a view which is provided in a different layout via an include. However, it is usually an accident where you have a typo or you have renamed a view without updating all the references to it.
To suppress this error, use the issue id "UnknownIdInLayout" as explained in the Suppressing Warnings and Errors section.
UnknownNullness
Disabled By: Default
To improve referencing this code from Kotlin, consider adding
explicit nullness information here with either
You can set the environment variable
if you want lint to ignore classes and members that have been annotated with
To suppress this error, use the issue id "UnknownNullness" as explained in the Suppressing Warnings and Errors section.
explicit nullness information here with either
@NonNull
or @Nullable
.You can set the environment variable
ANDROID_LINT_NULLNESS_IGNORE_DEPRECATED=true
if you want lint to ignore classes and members that have been annotated with
@Deprecated
.To suppress this error, use the issue id "UnknownNullness" as explained in the Suppressing Warnings and Errors section.
UnlocalizedSms
Disabled By: Project lint.xml file
SMS destination numbers must start with a country code or the application code must ensure that the SMS is only sent when the user is in the same country as the receiver.
To suppress this error, use the issue id "UnlocalizedSms" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "UnlocalizedSms" as explained in the Suppressing Warnings and Errors section.
UnpackedNativeCode
Disabled By: Default
This app loads native libraries using
Consider adding
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnpackedNativeCode" as explained in the Suppressing Warnings and Errors section.
System.loadLibrary()
.Consider adding
android:extractNativeLibs="false"
to the <application>
tag in AndroidManifest.xml. Starting with Android 6.0, this will make installation faster, the app will take up less space on the device and updates will have smaller download sizes.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnpackedNativeCode" as explained in the Suppressing Warnings and Errors section.
UnprotectedSMSBroadcastReceiver
Disabled By: Project lint.xml file
BroadcastReceivers that declare an intent-filter for SMS_DELIVER or SMS_RECEIVED must ensure that the caller has the BROADCAST_SMS permission, otherwise it is possible for malicious actors to spoof intents.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnprotectedSMSBroadcastReceiver" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnprotectedSMSBroadcastReceiver" as explained in the Suppressing Warnings and Errors section.
UnsafeDynamicallyLoadedCode
Disabled By: Project lint.xml file
Dynamically loading code from locations other than the application's library directory or the Android platform's built-in library directories is dangerous, as there is an increased risk that the code could have been tampered with. Applications should use
To suppress this error, use the issue id "UnsafeDynamicallyLoadedCode" as explained in the Suppressing Warnings and Errors section.
loadLibrary
when possible, which provides increased assurance that libraries are loaded from one of these safer locations. Application developers should use the features of their development environment to place application native libraries into the lib directory of their compiled APKs.To suppress this error, use the issue id "UnsafeDynamicallyLoadedCode" as explained in the Suppressing Warnings and Errors section.
UnsafeNativeCodeLocation
Disabled By: Project lint.xml file
In general, application native code should only be placed in the application's library directory, not in other locations such as the res or assets directories. Placing the code in the library directory provides increased assurance that the code will not be tampered with after application installation. Application developers should use the features of their development environment to place application native libraries into the lib directory of their compiled APKs. Embedding non-shared library native executables into applications should be avoided when possible.
To suppress this error, use the issue id "UnsafeNativeCodeLocation" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "UnsafeNativeCodeLocation" as explained in the Suppressing Warnings and Errors section.
UnsafeProtectedBroadcastReceiver
Disabled By: Project lint.xml file
BroadcastReceivers that declare an intent-filter for a protected-broadcast action string must check that the received intent's action string matches the expected value, otherwise it is possible for malicious actors to spoof intents.
To suppress this error, use the issue id "UnsafeProtectedBroadcastReceiver" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "UnsafeProtectedBroadcastReceiver" as explained in the Suppressing Warnings and Errors section.
UnsupportedChromeOsHardware
Disabled By: Default
The
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnsupportedChromeOsHardware" as explained in the Suppressing Warnings and Errors section.
<uses-feature>
element should not require this unsupported Chrome OS hardware feature. Any uses-feature not explicitly marked with required="false"
is necessary on the device to be installed on. Ensure that any features that might prevent it from being installed on a Chrome OS device are reviewed and marked as not required in the manifest.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnsupportedChromeOsHardware" as explained in the Suppressing Warnings and Errors section.
UnsupportedTvHardware
Disabled By: Project lint.xml file
The <uses-feature> element should not require this unsupported TV hardware feature. Any uses-feature not explicitly marked with required="false" is necessary on the device to be installed on. Ensure that any features that might prevent it from being installed on a TV device are reviewed and marked as not required in the manifest.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnsupportedTvHardware" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnsupportedTvHardware" as explained in the Suppressing Warnings and Errors section.
Untranslatable
Disabled By: Project lint.xml file
Strings can be marked with
There are cases where translators accidentally translate these strings anyway, and lint will flag these occurrences with this lint check.
To suppress this error, use the issue id "Untranslatable" as explained in the Suppressing Warnings and Errors section.
translatable=false
to indicate that they are not intended to be translated, but are present in the resource file for other purposes (for example for non-display strings that should vary by some other configuration qualifier such as screen size or API level).There are cases where translators accidentally translate these strings anyway, and lint will flag these occurrences with this lint check.
To suppress this error, use the issue id "Untranslatable" as explained in the Suppressing Warnings and Errors section.
UnusedAttribute
Disabled By: Project lint.xml file
This check finds attributes set in XML files that were introduced in a version newer than the oldest version targeted by your application (with the
This is not an error; the application will simply ignore the attribute. However, if the attribute is important to the appearance or functionality of your application, you should consider finding an alternative way to achieve the same result with only available attributes, and then you can optionally create a copy of the layout in a layout-vNN folder which will be used on API NN or higher where you can take advantage of the newer attribute.
Note: This check does not only apply to attributes. For example, some tags can be unused too, such as the new
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnusedAttribute" as explained in the Suppressing Warnings and Errors section.
minSdkVersion
attribute).This is not an error; the application will simply ignore the attribute. However, if the attribute is important to the appearance or functionality of your application, you should consider finding an alternative way to achieve the same result with only available attributes, and then you can optionally create a copy of the layout in a layout-vNN folder which will be used on API NN or higher where you can take advantage of the newer attribute.
Note: This check does not only apply to attributes. For example, some tags can be unused too, such as the new
<tag>
element in layouts introduced in API 21.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnusedAttribute" as explained in the Suppressing Warnings and Errors section.
UnusedIds
Disabled By: Default
This resource id definition appears not to be needed since it is not referenced from anywhere. Having id definitions, even if unused, is not necessarily a bad idea since they make working on layouts and menus easier, so there is not a strong reason to delete these.
The unused resource check can ignore tests. If you want to include resources that are only referenced from tests, consider packaging them in a test source set instead.
You can include test sources in the unused resource check by setting the system property lint.unused-resources.include-tests=true, and to exclude them (usually for performance reasons), use lint.unused-resources.exclude-tests=true.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnusedIds" as explained in the Suppressing Warnings and Errors section.
The unused resource check can ignore tests. If you want to include resources that are only referenced from tests, consider packaging them in a test source set instead.
You can include test sources in the unused resource check by setting the system property lint.unused-resources.include-tests=true, and to exclude them (usually for performance reasons), use lint.unused-resources.exclude-tests=true.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnusedIds" as explained in the Suppressing Warnings and Errors section.
UnusedNamespace
Disabled By: Project lint.xml file
Unused namespace declarations take up space and require processing that is not necessary
To suppress this error, use the issue id "UnusedNamespace" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "UnusedNamespace" as explained in the Suppressing Warnings and Errors section.
UnusedQuantity
Disabled By: Project lint.xml file
Android defines a number of different quantity strings, such as
This lint check looks at the quantity strings defined for each translation and flags any quantity strings that are unused (because the language does not make that quantity distinction, and Android will therefore not look it up).
For example, in Chinese, only the
To suppress this error, use the issue id "UnusedQuantity" as explained in the Suppressing Warnings and Errors section.
zero
, one
, few
and many
. However, many languages do not distinguish grammatically between all these different quantities.This lint check looks at the quantity strings defined for each translation and flags any quantity strings that are unused (because the language does not make that quantity distinction, and Android will therefore not look it up).
For example, in Chinese, only the
other
quantity is used, so even if you provide translations for zero
and one
, these strings will not be returned when getQuantityString()
is called, even with 0
or 1
.To suppress this error, use the issue id "UnusedQuantity" as explained in the Suppressing Warnings and Errors section.
UnusedResources
Disabled By: Project lint.xml file
Unused resources make applications larger and slow down builds.
The unused resource check can ignore tests. If you want to include resources that are only referenced from tests, consider packaging them in a test source set instead.
You can include test sources in the unused resource check by setting the system property lint.unused-resources.include-tests=true, and to exclude them (usually for performance reasons), use lint.unused-resources.exclude-tests=true.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnusedResources" as explained in the Suppressing Warnings and Errors section.
The unused resource check can ignore tests. If you want to include resources that are only referenced from tests, consider packaging them in a test source set instead.
You can include test sources in the unused resource check by setting the system property lint.unused-resources.include-tests=true, and to exclude them (usually for performance reasons), use lint.unused-resources.exclude-tests=true.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UnusedResources" as explained in the Suppressing Warnings and Errors section.
UseAlpha2
Disabled By: Project lint.xml file
For compatibility with earlier devices, you should only use 3-letter language and region codes when there is no corresponding 2 letter code.
More info: https://tools.ietf.org/html/bcp47
To suppress this error, use the issue id "UseAlpha2" as explained in the Suppressing Warnings and Errors section.UseCheckPermission
Disabled By: Project lint.xml file
You normally want to use the result of checking a permission; these methods return whether the permission is held; they do not throw an error if the permission is not granted. Code which does not do anything with the return value probably meant to be calling the enforce methods instead, e.g. rather than
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UseCheckPermission" as explained in the Suppressing Warnings and Errors section.
Context#checkCallingPermission
it should call Context#enforceCallingPermission
.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UseCheckPermission" as explained in the Suppressing Warnings and Errors section.
UseCompoundDrawables
Disabled By: Project lint.xml file
A
If the two widgets are offset from each other with margins, this can be replaced with a
There's a lint quickfix to perform this conversion in the Eclipse plugin.
To suppress this error, use the issue id "UseCompoundDrawables" as explained in the Suppressing Warnings and Errors section.
LinearLayout
which contains an ImageView
and a TextView
can be more efficiently handled as a compound drawable (a single TextView, using the drawableTop
, drawableLeft
, drawableRight
and/or drawableBottom
attributes to draw one or more images adjacent to the text).If the two widgets are offset from each other with margins, this can be replaced with a
drawablePadding
attribute.There's a lint quickfix to perform this conversion in the Eclipse plugin.
To suppress this error, use the issue id "UseCompoundDrawables" as explained in the Suppressing Warnings and Errors section.
UseOfBundledGooglePlayServices
Disabled By: Project lint.xml file
Google Play services SDK's can be selectively included, which enables a smaller APK size. Consider declaring dependencies on individual Google Play services SDK's. If you are using Firebase API's (http://firebase.google.com/docs/android/setup), Android Studio's Tools → Firebase assistant window can automatically add just the dependencies needed for each feature.
To suppress this error, use the issue id "UseOfBundledGooglePlayServices" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "UseOfBundledGooglePlayServices" as explained in the Suppressing Warnings and Errors section.
UseSparseArrays
Disabled By: Project lint.xml file
For maps where the keys are of type integer, it's typically more efficient to use the Android
This is particularly useful when the value types are primitives like ints, where you can use
If you need to construct a
To suppress this error, use the issue id "UseSparseArrays" as explained in the Suppressing Warnings and Errors section.
SparseArray
API. This check identifies scenarios where you might want to consider using SparseArray
instead of HashMap
for better performance.This is particularly useful when the value types are primitives like ints, where you can use
SparseIntArray
and avoid auto-boxing the values from int
to Integer
.If you need to construct a
HashMap
because you need to call an API outside of your control which requires a Map
, you can suppress this warning using for example the @SuppressLint
annotation.To suppress this error, use the issue id "UseSparseArrays" as explained in the Suppressing Warnings and Errors section.
UseValueOf
Disabled By: Project lint.xml file
You should not call the constructor for wrapper classes directly, such as`new Integer(42)`. Instead, call the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UseValueOf" as explained in the Suppressing Warnings and Errors section.
valueOf
factory method, such as Integer.valueOf(42)
. This will typically use less memory because common integers such as 0 and 1 will share a single instance.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UseValueOf" as explained in the Suppressing Warnings and Errors section.
UselessLeaf
Disabled By: Project lint.xml file
A layout that has no children or no background can often be removed (since it is invisible) for a flatter and more efficient layout hierarchy.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UselessLeaf" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UselessLeaf" as explained in the Suppressing Warnings and Errors section.
UselessParent
Disabled By: Project lint.xml file
A layout with children that has no siblings, is not a scrollview or a root layout, and does not have a background, can be removed and have its children moved directly into the parent for a flatter and more efficient layout hierarchy.
To suppress this error, use the issue id "UselessParent" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "UselessParent" as explained in the Suppressing Warnings and Errors section.
UsesMinSdkAttributes
Disabled By: Project lint.xml file
The manifest should contain a
To suppress this error, use the issue id "UsesMinSdkAttributes" as explained in the Suppressing Warnings and Errors section.
<uses-sdk>
element which defines the minimum API Level required for the application to run, as well as the target version (the highest API level you have tested the version for).To suppress this error, use the issue id "UsesMinSdkAttributes" as explained in the Suppressing Warnings and Errors section.
UsingC2DM
Disabled By: Project lint.xml file
The C2DM library does not work on Android P or newer devices; you should migrate to Firebase Cloud Messaging to ensure reliable message delivery.
To suppress this error, use the issue id "UsingC2DM" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "UsingC2DM" as explained in the Suppressing Warnings and Errors section.
UsingHttp
Disabled By: Project lint.xml file
The Gradle Wrapper is available both via HTTP and HTTPS. HTTPS is more secure since it protects against man-in-the-middle attacks etc. Older projects created in Android Studio used HTTP but we now default to HTTPS and recommend upgrading existing projects.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UsingHttp" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "UsingHttp" as explained in the Suppressing Warnings and Errors section.
ValidFragment
Disabled By: Project lint.xml file
From the Fragment documentation:
Every fragment must have an empty constructor, so it can be instantiated when restoring its activity's state. It is strongly recommended that subclasses do not have other constructors with parameters, since these constructors will not be called when the fragment is re-instantiated; instead, arguments can be supplied by the caller with
To suppress this error, use the issue id "ValidFragment" as explained in the Suppressing Warnings and Errors section.
Every fragment must have an empty constructor, so it can be instantiated when restoring its activity's state. It is strongly recommended that subclasses do not have other constructors with parameters, since these constructors will not be called when the fragment is re-instantiated; instead, arguments can be supplied by the caller with
setArguments(Bundle)
and later retrieved by the Fragment with getArguments()
.To suppress this error, use the issue id "ValidFragment" as explained in the Suppressing Warnings and Errors section.
VectorDrawableCompat
Disabled By: Project lint.xml file
To use VectorDrawableCompat, you need to make two modifications to your project. First, set
To suppress this error, use the issue id "VectorDrawableCompat" as explained in the Suppressing Warnings and Errors section.
android.defaultConfig.vectorDrawables.useSupportLibrary = true
in your build.gradle
file, and second, use app:srcCompat
instead of android:src
to refer to vector drawables.To suppress this error, use the issue id "VectorDrawableCompat" as explained in the Suppressing Warnings and Errors section.
VectorPath
Disabled By: Project lint.xml file
Using long vector paths is bad for performance. There are several ways to make the
* Using less precision
* Removing some minor details
* Using the Android Studio vector conversion tool
* Rasterizing the image (converting to PNG)
To suppress this error, use the issue id "VectorPath" as explained in the Suppressing Warnings and Errors section.
pathData
shorter:* Using less precision
* Removing some minor details
* Using the Android Studio vector conversion tool
* Rasterizing the image (converting to PNG)
To suppress this error, use the issue id "VectorPath" as explained in the Suppressing Warnings and Errors section.
VectorRaster
Disabled By: Project lint.xml file
Vector icons require API 21 or API 24 depending on used features, but when
However, there are some limitations to this raster image generation, and this lint check flags elements and attributes that are not fully supported. You should manually check whether the generated output is acceptable for those older devices.
To suppress this error, use the issue id "VectorRaster" as explained in the Suppressing Warnings and Errors section.
minSdkVersion
is less than 21 or 24 and Android Gradle plugin 1.4 or higher is used, a vector drawable placed in the drawable
folder is automatically moved to drawable-anydpi-v21
or drawable-anydpi-v24
and bitmap images are generated for different screen resolutions for backwards compatibility.However, there are some limitations to this raster image generation, and this lint check flags elements and attributes that are not fully supported. You should manually check whether the generated output is acceptable for those older devices.
To suppress this error, use the issue id "VectorRaster" as explained in the Suppressing Warnings and Errors section.
ViewConstructor
Disabled By: Project lint.xml file
Some layout tools (such as the Android layout editor) need to find a constructor with one of the following signatures:
*
*
*
If your custom view needs to perform initialization which does not apply when used in a layout editor, you can surround the given code with a check to see if
To suppress this error, use the issue id "ViewConstructor" as explained in the Suppressing Warnings and Errors section.
*
View(Context context)
*
View(Context context, AttributeSet attrs)
*
View(Context context, AttributeSet attrs, int defStyle)
If your custom view needs to perform initialization which does not apply when used in a layout editor, you can surround the given code with a check to see if
View#isInEditMode()
is false, since that method will return false
at runtime but true within a user interface editor.To suppress this error, use the issue id "ViewConstructor" as explained in the Suppressing Warnings and Errors section.
ViewHolder
Disabled By: Project lint.xml file
When implementing a view Adapter, you should avoid unconditionally inflating a new layout; if an available item is passed in for reuse, you should try to use that one instead. This helps make for example ListView scrolling much smoother.
To suppress this error, use the issue id "ViewHolder" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "ViewHolder" as explained in the Suppressing Warnings and Errors section.
ViewTag
Disabled By: Project lint.xml file
Prior to Android 4.0, the implementation of
To suppress this error, use the issue id "ViewTag" as explained in the Suppressing Warnings and Errors section.
View.setTag(int, Object)
would store the objects in a static map, where the values were strongly referenced. This means that if the object contains any references pointing back to the context, the context (which points to pretty much everything else) will leak. If you pass a view, the view provides a reference to the context that created it. Similarly, view holders typically contain a view, and cursors are sometimes also associated with views.To suppress this error, use the issue id "ViewTag" as explained in the Suppressing Warnings and Errors section.
VisibleForTests
Disabled By: Project lint.xml file
With the
This check looks for accesses from production code (e.g. not tests) where the access would not have been allowed with the intended production visibility.
To suppress this error, use the issue id "VisibleForTests" as explained in the Suppressing Warnings and Errors section.
@VisibleForTesting
annotation you can specify an otherwise=
attribute which specifies the intended visibility if the method had not been made more widely visible for the tests.This check looks for accesses from production code (e.g. not tests) where the access would not have been allowed with the intended production visibility.
To suppress this error, use the issue id "VisibleForTests" as explained in the Suppressing Warnings and Errors section.
VulnerableCordovaVersion
Disabled By: Project lint.xml file
The version of Cordova used in the app is vulnerable to security issues. Please update to the latest Apache Cordova version.
To suppress this error, use the issue id "VulnerableCordovaVersion" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "VulnerableCordovaVersion" as explained in the Suppressing Warnings and Errors section.
Wakelock
Disabled By: Project lint.xml file
Failing to release a wakelock properly can keep the Android device in a high power mode, which reduces battery life. There are several causes of this, such as releasing the wake lock in
NOTE: If you are using the lock just to keep the screen on, you should strongly consider using
To suppress this error, use the issue id "Wakelock" as explained in the Suppressing Warnings and Errors section.
onDestroy()
instead of in onPause()
, failing to call release()
in all possible code paths after an acquire()
, and so on.NOTE: If you are using the lock just to keep the screen on, you should strongly consider using
FLAG_KEEP_SCREEN_ON
instead. This window flag will be correctly managed by the platform as the user moves between applications and doesn't require a special permission. See http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_KEEP_SCREEN_ON.To suppress this error, use the issue id "Wakelock" as explained in the Suppressing Warnings and Errors section.
WakelockTimeout
Disabled By: Project lint.xml file
Wakelocks have two acquire methods: one with a timeout, and one without. You should generally always use the one with a timeout. A typical timeout is 10 minutes. If the task takes longer than it is critical that it happens (i.e. can't use
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WakelockTimeout" as explained in the Suppressing Warnings and Errors section.
JobScheduler
) then maybe they should consider a foreground service instead (which is a stronger run guarantee and lets the user know something long/important is happening).Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WakelockTimeout" as explained in the Suppressing Warnings and Errors section.
WearStandaloneAppFlag
Disabled By: Project lint.xml file
Wearable apps should specify whether they can work standalone, without a phone app.Add a valid meta-data entry for
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WearStandaloneAppFlag" as explained in the Suppressing Warnings and Errors section.
com.google.android.wearable.standalone
to your application element and set the value to true
or false
.<meta-data android:name="com.google.android.wearable.standalone"
android:value="true"/>
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WearStandaloneAppFlag" as explained in the Suppressing Warnings and Errors section.
WebViewLayout
Disabled By: Project lint.xml file
The WebView implementation has certain performance optimizations which will not work correctly if the parent view is using
To suppress this error, use the issue id "WebViewLayout" as explained in the Suppressing Warnings and Errors section.
wrap_content
rather than match_parent
. This can lead to subtle UI bugs.To suppress this error, use the issue id "WebViewLayout" as explained in the Suppressing Warnings and Errors section.
WebpUnsupported
Disabled By: Project lint.xml file
The WebP format requires Android 4.0 (API 15). Certain features, such as lossless encoding and transparency, requires Android 4.2.1 (API 18; API 17 is 4.2.0.)
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WebpUnsupported" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WebpUnsupported" as explained in the Suppressing Warnings and Errors section.
WifiManagerLeak
Disabled By: Project lint.xml file
On versions prior to Android N (24), initializing the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WifiManagerLeak" as explained in the Suppressing Warnings and Errors section.
WifiManager
via Context#getSystemService
can cause a memory leak if the context is not the application context. Change context.getSystemService(...)
to context.getApplicationContext().getSystemService(...)
.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WifiManagerLeak" as explained in the Suppressing Warnings and Errors section.
WifiManagerPotentialLeak
Disabled By: Project lint.xml file
On versions prior to Android N (24), initializing the
In many cases, it's not obvious from the code where the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WifiManagerPotentialLeak" as explained in the Suppressing Warnings and Errors section.
WifiManager
via Context#getSystemService
can cause a memory leak if the context is not the application context.In many cases, it's not obvious from the code where the
Context
is coming from (e.g. it might be a parameter to a method, or a field initialized from various method calls). It's possible that the context being passed in is the application context, but to be on the safe side, you should consider changing context.getSystemService(...)
to context.getApplicationContext().getSystemService(...)
.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WifiManagerPotentialLeak" as explained in the Suppressing Warnings and Errors section.
WorldReadableFiles
Disabled By: Project lint.xml file
There are cases where it is appropriate for an application to write world readable files, but these should be reviewed carefully to ensure that they contain no private data that is leaked to other applications.
To suppress this error, use the issue id "WorldReadableFiles" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "WorldReadableFiles" as explained in the Suppressing Warnings and Errors section.
WorldWriteableFiles
Disabled By: Project lint.xml file
There are cases where it is appropriate for an application to write world writeable files, but these should be reviewed carefully to ensure that they contain no private data, and that if the file is modified by a malicious application it does not trick or compromise your application.
To suppress this error, use the issue id "WorldWriteableFiles" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "WorldWriteableFiles" as explained in the Suppressing Warnings and Errors section.
WrongCall
Disabled By: Project lint.xml file
Custom views typically need to call
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WrongCall" as explained in the Suppressing Warnings and Errors section.
measure()
on their children, not onMeasure
. Ditto for onDraw, onLayout, etc.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "WrongCall" as explained in the Suppressing Warnings and Errors section.
WrongConstant
Disabled By: Project lint.xml file
Ensures that when parameter in a method only allows a specific set of constants, calls obey those rules.
To suppress this error, use the issue id "WrongConstant" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "WrongConstant" as explained in the Suppressing Warnings and Errors section.
WrongRegion
Disabled By: Project lint.xml file
Android uses the letter codes ISO 639-1 for languages, and the letter codes ISO 3166-1 for the region codes. In many cases, the language code and the country where the language is spoken is the same, but it is also often not the case. For example, while 'se' refers to Sweden, where Swedish is spoken, the language code for Swedish is not
This lint check looks for suspicious language and region combinations, to help catch cases where you've accidentally used the wrong language or region code. Lint knows about the most common regions where a language is spoken, and if a folder combination is not one of these, it is flagged as suspicious.
Note however that it may not be an error: you can theoretically have speakers of any language in any region and want to target that with your resources, so this check is aimed at tracking down likely mistakes, not to enforce a specific set of region and language combinations.
To suppress this error, use the issue id "WrongRegion" as explained in the Suppressing Warnings and Errors section.
se
(which refers to the Northern Sami language), the language code is sv
. And similarly the region code for sv
is El Salvador.This lint check looks for suspicious language and region combinations, to help catch cases where you've accidentally used the wrong language or region code. Lint knows about the most common regions where a language is spoken, and if a folder combination is not one of these, it is flagged as suspicious.
Note however that it may not be an error: you can theoretically have speakers of any language in any region and want to target that with your resources, so this check is aimed at tracking down likely mistakes, not to enforce a specific set of region and language combinations.
To suppress this error, use the issue id "WrongRegion" as explained in the Suppressing Warnings and Errors section.
WrongThread
Disabled By: Project lint.xml file
Ensures that a method which expects to be called on a specific thread, is actually called from that thread. For example, calls on methods in widgets should always be made on the UI thread.
To suppress this error, use the issue id "WrongThread" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "WrongThread" as explained in the Suppressing Warnings and Errors section.
WrongThreadInterprocedural
Disabled By: Default
Searches for interprocedural call paths that violate thread annotations in the program. Tracks the flow of instantiated types and lambda expressions to increase accuracy across method boundaries.
To suppress this error, use the issue id "WrongThreadInterprocedural" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "WrongThreadInterprocedural" as explained in the Suppressing Warnings and Errors section.
WrongViewCast
Disabled By: Project lint.xml file
Keeps track of the view types associated with ids and if it finds a usage of the id in the Java code it ensures that it is treated as the same type.
To suppress this error, use the issue id "WrongViewCast" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "WrongViewCast" as explained in the Suppressing Warnings and Errors section.
Suppressing Warnings and Errors
Lint errors can be suppressed in a variety of ways:
1. With a
2. With a
3. With a //noinspection comment in the source code
4. With ignore flags specified in the
5. With a
6. With a
7. With the --ignore flag passed to lint.
To suppress a lint warning with an annotation, add a
To suppress a lint warning with a comment, add a
To suppress a lint warning in an XML file, add a
To suppress a lint warning in a
android {
lintOptions {
disable 'TypographyFractions','TypographyQuotes'
}
}
Here we specify a comma separated list of issue id's after the disable command. You can also use
To suppress lint warnings with a configuration XML file, create a file named
The format of the
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Ignore everything in the test source set -->
<issue id="all">
<ignore path="*/test/*" />
</issue>
<!-- Disable this given check in this project -->
<issue id="IconMissingDensityFolder" severity="ignore" />
<!-- Ignore the ObsoleteLayoutParam issue in the given files -->
<issue id="ObsoleteLayoutParam">
<ignore path="res/layout/activation.xml" />
<ignore path="res/layout-xlarge/activation.xml" />
<ignore regexp="(foo|bar).java" />
</issue>
<!-- Ignore the UselessLeaf issue in the given file -->
<issue id="UselessLeaf">
<ignore path="res/layout/main.xml" />
</issue>
<!-- Change the severity of hardcoded strings to "error" -->
<issue id="HardcodedText" severity="error" />
</lint>
To suppress lint checks from the command line, pass the --ignore flag with a comma separated list of ids to be suppressed, such as:
For more information, see http://g.co/androidstudio/suppressing-lint-warnings
1. With a
@SuppressLint
annotation in the Java code2. With a
tools:ignore
attribute in the XML file3. With a //noinspection comment in the source code
4. With ignore flags specified in the
build.gradle
file, as explained below5. With a
lint.xml
configuration file in the project6. With a
lint.xml
configuration file passed to lint via the --config flag7. With the --ignore flag passed to lint.
To suppress a lint warning with an annotation, add a
@SuppressLint("id")
annotation on the class, method or variable declaration closest to the warning instance you want to disable. The id can be one or more issue id's, such as "UnusedResources"
or {"UnusedResources","UnusedIds"}
, or it can be "all"
to suppress all lint warnings in the given scope.To suppress a lint warning with a comment, add a
//noinspection id
comment on the line before the statement with the error.To suppress a lint warning in an XML file, add a
tools:ignore="id"
attribute on the element containing the error, or one of its surrounding elements. You also need to define the namespace for the tools prefix on the root element in your document, next to the xmlns:android
declaration:xmlns:tools="http://schemas.android.com/tools"
To suppress a lint warning in a
build.gradle
file, add a section like this:android {
lintOptions {
disable 'TypographyFractions','TypographyQuotes'
}
}
Here we specify a comma separated list of issue id's after the disable command. You can also use
warning
or error
instead of disable
to change the severity of issues.To suppress lint warnings with a configuration XML file, create a file named
lint.xml
and place it at the root directory of the module in which it applies.The format of the
lint.xml
file is something like the following:<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Ignore everything in the test source set -->
<issue id="all">
<ignore path="*/test/*" />
</issue>
<!-- Disable this given check in this project -->
<issue id="IconMissingDensityFolder" severity="ignore" />
<!-- Ignore the ObsoleteLayoutParam issue in the given files -->
<issue id="ObsoleteLayoutParam">
<ignore path="res/layout/activation.xml" />
<ignore path="res/layout-xlarge/activation.xml" />
<ignore regexp="(foo|bar).java" />
</issue>
<!-- Ignore the UselessLeaf issue in the given file -->
<issue id="UselessLeaf">
<ignore path="res/layout/main.xml" />
</issue>
<!-- Change the severity of hardcoded strings to "error" -->
<issue id="HardcodedText" severity="error" />
</lint>
To suppress lint checks from the command line, pass the --ignore flag with a comma separated list of ids to be suppressed, such as:
$ lint --ignore UnusedResources,UselessLeaf /my/project/path
For more information, see http://g.co/androidstudio/suppressing-lint-warnings