Overview
| Correctness | |
| 3 | error ResAuto: Hardcoded Package in Namespace |
| 2 | error ResourceCycle: Cycle in resource definitions |
| 1 | error DuplicateIds: Duplicate ids within a single layout |
| Disabled Checks (306) |
Hardcoded Package in Namespace
../../src/main/res/layout/custom_layout.xml:22: In Gradle projects, always use
http://schemas.android.com/apk/res-auto
for custom attributes19 <!-- BEGIN_INCLUDE(Complete) --> 20 <com.example.android.apis.view.CustomLayout 21 xmlns:android="http://schemas.android.com/apk/res/android" 22 xmlns:app="http://schemas.android.com/apk/res/com.example.android.apis" 23 android:layout_width="match_parent" 24 android:layout_height="match_parent">../../src/main/res/layout/custom_view_1.xml:20: In Gradle projects, always use
http://schemas.android.com/apk/res-auto
for custom attributes17 <!-- Demonstrates defining custom views in a layout file. --> 18 19 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 20 xmlns:app="http://schemas.android.com/apk/res/com.example.android.apis" 21 android:orientation="vertical" 22 android:layout_width="match_parent" 23 android:layout_height="wrap_content">../../src/main/res/layout/drag_layout.xml:20: In Gradle projects, always use
http://schemas.android.com/apk/res-auto
for custom attributes17 <!-- Layout description of the DragAndDrop sample's main activity --> 18 19 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 20 xmlns:dot="http://schemas.android.com/apk/res/com.example.android.apis" 21 android:layout_width="match_parent" 22 android:layout_height="wrap_content" 23 android:orientation="vertical"
In Gradle projects, the actual package used in the final APK can vary; for example,you can add a
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ResAuto" as explained in the Suppressing Warnings and Errors section.
.debug
package suffix in one version and not the other. Therefore, you should not hardcode the application package in the resource; instead, use the special namespace http://schemas.android.com/apk/res-auto
which will cause the tools to figure out the right namespace for the resource regardless of the actual package used during the build.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ResAuto" as explained in the Suppressing Warnings and Errors section.
ResAuto
Correctness
Fatal
Priority 9/10
Cycle in resource definitions
../../src/main/res/values/styles.xml:75: Style
Theme.Wallpaper
should not extend itself72 <!-- A theme that has a wallpaper background. Here we explicitly specify 73 that this theme is to inherit from the system's wallpaper theme, 74 which sets up various attributes correctly. --> 75 <style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper"> 76 <item name="android:colorForeground">#fff</item> 77 </style>../../src/main/res/values/styles.xml:82: Style
Theme.Translucent
should not extend itself79 <!-- A theme that has a translucent background. Here we explicitly specify 80 that this theme is to inherit from the system's translucent theme, 81 which sets up various attributes correctly. --> 82 <style name="Theme.Translucent" parent="android:style/Theme.Translucent"> 83 <item name="android:windowBackground">@drawable/translucent_background</item> 84 <item name="android:windowNoTitle">true</item> 85 <item name="android:colorForeground">#fff</item>
There should be no cycles in resource definitions as this can lead to runtime exceptions.
To suppress this error, use the issue id "ResourceCycle" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "ResourceCycle" as explained in the Suppressing Warnings and Errors section.
ResourceCycle
Correctness
Fatal
Priority 8/10
Duplicate ids within a single layout
../../src/main/res/menu/submenu.xml:40: Duplicate id
@+id/d
, already defined earlier in this layout37 <menu> 38 <item android:id="@+id/d" 39 android:title="Dddddd" /> 40 <item android:id="@+id/d" 41 android:title="Eeeeee"> 42 <menu> 43 <item android:title="Ffffff" />
- ../../src/main/res/menu/submenu.xml:38: Duplicate id
@+id/d
originally defined here35 android:title="Ccccccc (More)"> 36 37 <menu> 38 <item android:id="@+id/d" 39 android:title="Dddddd" /> 40 <item android:id="@+id/d" 41 android:title="Eeeeee">
Within a layout, id's should be unique since otherwise
To suppress this error, use the issue id "DuplicateIds" as explained in the Suppressing Warnings and Errors section.
findViewById()
can return an unexpected view.To suppress this error, use the issue id "DuplicateIds" as explained in the Suppressing Warnings and Errors section.
DuplicateIds
Correctness
Fatal
Priority 7/10
Disabled Checks
One or more issues were not run by lint, either
because the check is not enabled by default, or because
it was disabled with a command line flag or via one or
more
lint.xml
configuration files in the project directories.
AccidentalOctal
Disabled By: Project lint.xml file
In Groovy, an integer literal that starts with a leading 0 will be interpreted as an octal number. That is usually (always?) an accident and can lead to subtle bugs, for example when used in the
To suppress this error, use the issue id "AccidentalOctal" as explained in the Suppressing Warnings and Errors section.
versionCode
of an app.To suppress this error, use the issue id "AccidentalOctal" as explained in the Suppressing Warnings and Errors section.
AdapterViewChildren
Disabled By: Project lint.xml file
AdapterViews such as ListViews must be configured with data from Java code, such as a ListAdapter.
To suppress this error, use the issue id "AdapterViewChildren" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "AdapterViewChildren" as explained in the Suppressing Warnings and Errors section.
AddJavascriptInterface
Disabled By: Project lint.xml file
For applications built for API levels below 17,
To suppress this error, use the issue id "AddJavascriptInterface" as explained in the Suppressing Warnings and Errors section.
WebView#addJavascriptInterface
presents a security hazard as JavaScript on the target web page has the ability to use reflection to access the injected object's public fields and thus manipulate the host application in unintended ways.To suppress this error, use the issue id "AddJavascriptInterface" as explained in the Suppressing Warnings and Errors section.
AllCaps
Disabled By: Project lint.xml file
The textAllCaps text transform will end up calling
To suppress this error, use the issue id "AllCaps" as explained in the Suppressing Warnings and Errors section.
toString
on the CharSequence
, which has the net effect of removing any markup such as <b>
. This check looks for usages of strings containing markup that also specify textAllCaps=true
.To suppress this error, use the issue id "AllCaps" as explained in the Suppressing Warnings and Errors section.
AllowAllHostnameVerifier
Disabled By: Project lint.xml file
This check looks for use of HostnameVerifier implementations whose
To suppress this error, use the issue id "AllowAllHostnameVerifier" as explained in the Suppressing Warnings and Errors section.
verify
method always returns true (thus trusting any hostname) which could result in insecure network traffic caused by trusting arbitrary hostnames in TLS/SSL certificates presented by peers.To suppress this error, use the issue id "AllowAllHostnameVerifier" as explained in the Suppressing Warnings and Errors section.
AllowBackup
Disabled By: Project lint.xml file
The
By default, this flag is set to
This may have security consequences for an application.
Setting
To fix this warning, decide whether your application should support backup, and explicitly set
If not set to false, and if targeting API 23 or later, lint will also warn that you should set
To suppress this error, use the issue id "AllowBackup" as explained in the Suppressing Warnings and Errors section.
allowBackup
attribute determines if an application's data can be backed up and restored. It is documented at http://developer.android.com/reference/android/R.attr.html#allowBackupBy default, this flag is set to
true
. When this flag is set to true
, application data can be backed up and restored by the user using adb backup
and adb restore
.This may have security consequences for an application.
adb backup
allows users who have enabled USB debugging to copy application data off of the device. Once backed up, all application data can be read by the user. adb restore
allows creation of application data from a source specified by the user. Following a restore, applications should not assume that the data, file permissions, and directory permissions were created by the application itself.Setting
allowBackup="false"
opts an application out of both backup and restore.To fix this warning, decide whether your application should support backup, and explicitly set
android:allowBackup=(true|false)"
.If not set to false, and if targeting API 23 or later, lint will also warn that you should set
android:fullBackupContent
to configure auto backup.More info:
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "AllowBackup" as explained in the Suppressing Warnings and Errors section.
AlwaysShowAction
Disabled By: Project lint.xml file
Using
If
This check looks for menu XML files that contain more than two
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "AlwaysShowAction" as explained in the Suppressing Warnings and Errors section.
showAsAction="always"
in menu XML, or MenuItem.SHOW_AS_ACTION_ALWAYS
in Java code is usually a deviation from the user interface style guide.Use ifRoom
or the corresponding MenuItem.SHOW_AS_ACTION_IF_ROOM
instead.If
always
is used sparingly there are usually no problems and behavior is roughly equivalent to ifRoom
but with preference over other ifRoom
items. Using it more than twice in the same menu is a bad idea.This check looks for menu XML files that contain more than two
always
actions, or some always
actions and no ifRoom
actions. In Java code, it looks for projects that contain references to MenuItem.SHOW_AS_ACTION_ALWAYS
and no references to MenuItem.SHOW_AS_ACTION_IF_ROOM
.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "AlwaysShowAction" as explained in the Suppressing Warnings and Errors section.
AnimatorKeep
Disabled By: Project lint.xml file
When you use property animators, properties can be accessed via reflection. Those methods should be annotated with @Keep to ensure that during release builds, the methods are not potentially treated as unused and removed, or treated as internal only and get renamed to something shorter.
This check will also flag other potential reflection problems it encounters, such as a missing property, wrong argument types, etc.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "AnimatorKeep" as explained in the Suppressing Warnings and Errors section.
This check will also flag other potential reflection problems it encounters, such as a missing property, wrong argument types, etc.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "AnimatorKeep" as explained in the Suppressing Warnings and Errors section.
AppCompatCustomView
Disabled By: Project lint.xml file
In order to support features such as tinting, the appcompat library will automatically load special appcompat replacements for the builtin widgets. However, this does not work for your own custom views.
Instead of extending the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "AppCompatCustomView" as explained in the Suppressing Warnings and Errors section.
Instead of extending the
android.widget
classes directly, you should instead extend one of the delegate classes in android.support.v7.widget.AppCompat
.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "AppCompatCustomView" as explained in the Suppressing Warnings and Errors section.
AppCompatMethod
Disabled By: Project lint.xml file
When using the appcompat library, there are some methods you should be calling instead of the normal ones; for example,
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "AppCompatMethod" as explained in the Suppressing Warnings and Errors section.
getSupportActionBar()
instead of getActionBar()
. This lint check looks for calls to the wrong method.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "AppCompatMethod" as explained in the Suppressing Warnings and Errors section.
AppCompatResource
Disabled By: Project lint.xml file
When using the appcompat library, menu resources should refer to the
Similarly, when not using the appcompat library, you should be using the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "AppCompatResource" as explained in the Suppressing Warnings and Errors section.
showAsAction
(or actionViewClass
, or actionProviderClass
) in the app:
namespace, not the android:
namespace.Similarly, when not using the appcompat library, you should be using the
android:showAsAction
(or actionViewClass
, or actionProviderClass
) attribute.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "AppCompatResource" as explained in the Suppressing Warnings and Errors section.
AppIndexingService
Disabled By: Project lint.xml file
Apps targeting Android 8.0 or higher can no longer rely on background services while listening for updates to the on-device index. Use a
To suppress this error, use the issue id "AppIndexingService" as explained in the Suppressing Warnings and Errors section.
BroadcastReceiver
for the UPDATE_INDEX
intent to continue supporting indexing in your app.To suppress this error, use the issue id "AppIndexingService" as explained in the Suppressing Warnings and Errors section.
AppLinkUrlError
Disabled By: Project lint.xml file
Ensure the URL is supported by your app, to get installs and traffic to your app from Google Search.
To suppress this error, use the issue id "AppLinkUrlError" as explained in the Suppressing Warnings and Errors section.
More info: https://g.co/AppIndexing/AndroidStudio
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "AppLinkUrlError" as explained in the Suppressing Warnings and Errors section.
AppLinksAutoVerifyError
Disabled By: Default
Ensures that app links are correctly set and associated with website.
More info: https://g.co/appindexing/applinks
To suppress this error, use the issue id "AppLinksAutoVerifyError" as explained in the Suppressing Warnings and Errors section.AppLinksAutoVerifyWarning
Disabled By: Default
Ensures that app links are correctly set and associated with website.
More info: https://g.co/appindexing/applinks
To suppress this error, use the issue id "AppLinksAutoVerifyWarning" as explained in the Suppressing Warnings and Errors section.ApplySharedPref
Disabled By: Project lint.xml file
Consider using
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ApplySharedPref" as explained in the Suppressing Warnings and Errors section.
apply()
instead of commit
on shared preferences. Whereas commit
blocks and writes its data to persistent storage immediately, apply
will handle it in the background.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ApplySharedPref" as explained in the Suppressing Warnings and Errors section.
Assert
Disabled By: Project lint.xml file
Assertions are not checked at runtime. There are ways to request that they be used by Dalvik (
For example, you can replace
(Note: This lint check does not flag assertions purely asserting nullness or non-nullness; these are typically more intended for tools usage than runtime checks.)
To suppress this error, use the issue id "Assert" as explained in the Suppressing Warnings and Errors section.
adb shell setprop debug.assert 1
), but note that this is not implemented in ART (the newer runtime), and even in Dalvik the property is ignored in many places and can not be relied upon. Instead, perform conditional checking inside if (BuildConfig.DEBUG) { }
blocks. That constant is a static final boolean which is true in debug builds and false in release builds, and the Java compiler completely removes all code inside the if-body from the app.For example, you can replace
assert speed > 0
with if (BuildConfig.DEBUG && !(speed > 0)) { throw new AssertionError() }
.(Note: This lint check does not flag assertions purely asserting nullness or non-nullness; these are typically more intended for tools usage than runtime checks.)
To suppress this error, use the issue id "Assert" as explained in the Suppressing Warnings and Errors section.
AuthLeak
Disabled By: Project lint.xml file
Strings in java apps can be discovered by decompiling apps, this lint check looks for code which looks like it may contain an url with a username and password
To suppress this error, use the issue id "AuthLeak" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "AuthLeak" as explained in the Suppressing Warnings and Errors section.
Autofill
Disabled By: Project lint.xml file
Specify an
The hints can have any value, but it is recommended to use predefined values like 'username' for a username or 'creditCardNumber' for a credit card number. For a list of all predefined autofill hint constants, see the
You can mark a view unimportant for autofill by specifying an
To suppress this error, use the issue id "Autofill" as explained in the Suppressing Warnings and Errors section.
autofillHints
attribute when targeting SDK version 26 or higher or explicitly specify that the view is not important for autofill. Your app can help an autofill service classify the data correctly by providing the meaning of each view that could be autofillable, such as views representing usernames, passwords, credit card fields, email addresses, etc.The hints can have any value, but it is recommended to use predefined values like 'username' for a username or 'creditCardNumber' for a credit card number. For a list of all predefined autofill hint constants, see the
AUTOFILL_HINT_
constants in the View
reference at https://developer.android.com/reference/android/view/View.html.You can mark a view unimportant for autofill by specifying an
importantForAutofill
attribute on that view or a parent view. See https://developer.android.com/reference/android/view/View.html#setImportantForAutofill(int).To suppress this error, use the issue id "Autofill" as explained in the Suppressing Warnings and Errors section.
BackButton
Disabled By: Default
According to the Android Design Guide,
"Other platforms use an explicit back button with label to allow the user to navigate up the application's hierarchy. Instead, Android uses the main action bar's app icon for hierarchical navigation and the navigation bar's back button for temporal navigation."
This check is not very sophisticated (it just looks for buttons with the label "Back"), so it is disabled by default to not trigger on common scenarios like pairs of Back/Next buttons to paginate through screens.
To suppress this error, use the issue id "BackButton" as explained in the Suppressing Warnings and Errors section.
"Other platforms use an explicit back button with label to allow the user to navigate up the application's hierarchy. Instead, Android uses the main action bar's app icon for hierarchical navigation and the navigation bar's back button for temporal navigation."
This check is not very sophisticated (it just looks for buttons with the label "Back"), so it is disabled by default to not trigger on common scenarios like pairs of Back/Next buttons to paginate through screens.
To suppress this error, use the issue id "BackButton" as explained in the Suppressing Warnings and Errors section.
BadHostnameVerifier
Disabled By: Project lint.xml file
This check looks for implementations of
To suppress this error, use the issue id "BadHostnameVerifier" as explained in the Suppressing Warnings and Errors section.
HostnameVerifier
whose verify
method always returns true (thus trusting any hostname) which could result in insecure network traffic caused by trusting arbitrary hostnames in TLS/SSL certificates presented by peers.To suppress this error, use the issue id "BadHostnameVerifier" as explained in the Suppressing Warnings and Errors section.
BatteryLife
Disabled By: Project lint.xml file
This issue flags code that either
* negatively affects battery life, or
* uses APIs that have recently changed behavior to prevent background tasks from consuming memory and battery excessively.
Generally, you should be using
For more details on how to update your code, please see http://developer.android.com/preview/features/background-optimization.html
To suppress this error, use the issue id "BatteryLife" as explained in the Suppressing Warnings and Errors section.
* negatively affects battery life, or
* uses APIs that have recently changed behavior to prevent background tasks from consuming memory and battery excessively.
Generally, you should be using
JobScheduler
or GcmNetworkManager
instead.For more details on how to update your code, please see http://developer.android.com/preview/features/background-optimization.html
To suppress this error, use the issue id "BatteryLife" as explained in the Suppressing Warnings and Errors section.
BottomAppBar
Disabled By: Project lint.xml file
The
To suppress this error, use the issue id "BottomAppBar" as explained in the Suppressing Warnings and Errors section.
BottomAppBar
widget must be placed within a CoordinatorLayout
.To suppress this error, use the issue id "BottomAppBar" as explained in the Suppressing Warnings and Errors section.
ButtonCase
Disabled By: Project lint.xml file
The standard capitalization for OK/Cancel dialogs is "OK" and "Cancel". To ensure that your dialogs use the standard strings, you can use the resource strings @android:string/ok and @android:string/cancel.
To suppress this error, use the issue id "ButtonCase" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "ButtonCase" as explained in the Suppressing Warnings and Errors section.
ButtonOrder
Disabled By: Project lint.xml file
According to the Android Design Guide,
"Action buttons are typically Cancel and/or OK, with OK indicating the preferred or most likely action. However, if the options consist of specific actions such as Close or Wait rather than a confirmation or cancellation of the action described in the content, then all the buttons should be active verbs. As a rule, the dismissive action of a dialog is always on the left whereas the affirmative actions are on the right."
This check looks for button bars and buttons which look like cancel buttons, and makes sure that these are on the left.
To suppress this error, use the issue id "ButtonOrder" as explained in the Suppressing Warnings and Errors section.
"Action buttons are typically Cancel and/or OK, with OK indicating the preferred or most likely action. However, if the options consist of specific actions such as Close or Wait rather than a confirmation or cancellation of the action described in the content, then all the buttons should be active verbs. As a rule, the dismissive action of a dialog is always on the left whereas the affirmative actions are on the right."
This check looks for button bars and buttons which look like cancel buttons, and makes sure that these are on the left.
To suppress this error, use the issue id "ButtonOrder" as explained in the Suppressing Warnings and Errors section.
ButtonStyle
Disabled By: Project lint.xml file
Button bars typically use a borderless style for the buttons. Set the
To suppress this error, use the issue id "ButtonStyle" as explained in the Suppressing Warnings and Errors section.
style="?android:attr/buttonBarButtonStyle"
attribute on each of the buttons, and set style="?android:attr/buttonBarStyle"
on the parent layoutTo suppress this error, use the issue id "ButtonStyle" as explained in the Suppressing Warnings and Errors section.
ByteOrderMark
Disabled By: Project lint.xml file
Lint will flag any byte-order-mark (BOM) characters it finds in the middle of a file. Since we expect files to be encoded with UTF-8 (see the EnforceUTF8 issue), the BOM characters are not necessary, and they are not handled correctly by all tools. For example, if you have a BOM as part of a resource name in one particular translation, that name will not be considered identical to the base resource's name and the translation will not be used.
To suppress this error, use the issue id "ByteOrderMark" as explained in the Suppressing Warnings and Errors section.
More info: http://en.wikipedia.org/wiki/Byte_order_mark
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "ByteOrderMark" as explained in the Suppressing Warnings and Errors section.
CanvasSize
Disabled By: Project lint.xml file
In a custom view's draw implementation, you should normally call
Canvas width and height are the width and height of the
In the hardware accelerated path the width and height of the canvas typically always match that of the
You should only use Canvas state to adjust how much you draw, such as a quick-reject for early work avoidance if it's going to be clipped away, but not what you draw.
To suppress this error, use the issue id "CanvasSize" as explained in the Suppressing Warnings and Errors section.
getWidth
and getHeight
on the custom view itself, not on the canvas
instance.Canvas width and height are the width and height of the
Canvas
, which is not always the same as size of the view.In the hardware accelerated path the width and height of the canvas typically always match that of the
View
because every view goes to its own recorded DisplayList
. But in software rendering there's just one canvas that is clipped and transformed as it makes its way through the View
tree, and otherwise remains the same Canvas
object for every View's draw method.You should only use Canvas state to adjust how much you draw, such as a quick-reject for early work avoidance if it's going to be clipped away, but not what you draw.
To suppress this error, use the issue id "CanvasSize" as explained in the Suppressing Warnings and Errors section.
CheckResult
Disabled By: Project lint.xml file
Some methods have no side effects, an calling them without doing something without the result is suspicious.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "CheckResult" 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 "CheckResult" as explained in the Suppressing Warnings and Errors section.
ClickableViewAccessibility
Disabled By: Project lint.xml file
If a
To suppress this error, use the issue id "ClickableViewAccessibility" as explained in the Suppressing Warnings and Errors section.
View
that overrides onTouchEvent
or uses an OnTouchListener
does not also implement performClick
and call it when clicks are detected, the View
may not handle accessibility actions properly. Logic handling the click actions should ideally be placed in View#performClick
as some accessibility services invoke performClick
when a click action should occur.To suppress this error, use the issue id "ClickableViewAccessibility" as explained in the Suppressing Warnings and Errors section.
CommitPrefEdits
Disabled By: Project lint.xml file
After calling
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "CommitPrefEdits" as explained in the Suppressing Warnings and Errors section.
edit()
on a SharedPreference
, you must call commit()
or apply()
on the editor to save the results.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "CommitPrefEdits" as explained in the Suppressing Warnings and Errors section.
CommitTransaction
Disabled By: Project lint.xml file
After creating a
To suppress this error, use the issue id "CommitTransaction" as explained in the Suppressing Warnings and Errors section.
FragmentTransaction
, you typically need to commit it as wellTo suppress this error, use the issue id "CommitTransaction" as explained in the Suppressing Warnings and Errors section.
ConstantLocale
Disabled By: Project lint.xml file
Assigning
To suppress this error, use the issue id "ConstantLocale" as explained in the Suppressing Warnings and Errors section.
Locale.getDefault()
to a constant is suspicious, because the locale can change while the app is running.To suppress this error, use the issue id "ConstantLocale" as explained in the Suppressing Warnings and Errors section.
ContentDescription
Disabled By: Project lint.xml file
Non-textual widgets like ImageViews and ImageButtons should use the
Note that elements in application screens that are purely decorative and do not provide any content or enable a user action should not have accessibility content descriptions. In this case, just suppress the lint warning with a tools:ignore="ContentDescription" attribute.
Note that for text fields, you should not set both the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ContentDescription" as explained in the Suppressing Warnings and Errors section.
contentDescription
attribute to specify a textual description of the widget such that screen readers and other accessibility tools can adequately describe the user interface.Note that elements in application screens that are purely decorative and do not provide any content or enable a user action should not have accessibility content descriptions. In this case, just suppress the lint warning with a tools:ignore="ContentDescription" attribute.
Note that for text fields, you should not set both the
hint
and the contentDescription
attributes since the hint will never be shown. Just set the hint
. See http://developer.android.com/guide/topics/ui/accessibility/checklist.html#special-cases.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ContentDescription" as explained in the Suppressing Warnings and Errors section.
ConvertToWebp
Disabled By: Default
The WebP format is typically more compact than PNG and JPEG. As of Android 4.2.1 it supports transparency and lossless conversion as well. Note that there is a quickfix in the IDE which lets you perform conversion.
Launcher icons must be in the PNG format.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ConvertToWebp" as explained in the Suppressing Warnings and Errors section.
Launcher icons must be in the PNG format.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ConvertToWebp" as explained in the Suppressing Warnings and Errors section.
CustomViewStyleable
Disabled By: Project lint.xml file
The convention for custom views is to use a
(Similarly, layout parameter classes should use the suffix
To suppress this error, use the issue id "CustomViewStyleable" as explained in the Suppressing Warnings and Errors section.
declare-styleable
whose name matches the custom view class name. The IDE relies on this convention such that for example code completion can be offered for attributes in a custom view in layout XML resource files.(Similarly, layout parameter classes should use the suffix
_Layout
.)To suppress this error, use the issue id "CustomViewStyleable" as explained in the Suppressing Warnings and Errors section.
CutPasteId
Disabled By: Project lint.xml file
This lint check looks for cases where you have cut & pasted calls to
To suppress this error, use the issue id "CutPasteId" as explained in the Suppressing Warnings and Errors section.
findViewById
but have forgotten to update the R.id field. It's possible that your code is simply (redundantly) looking up the field repeatedly, but lint cannot distinguish that from a case where you for example want to initialize fields prev
and next
and you cut & pasted findViewById(R.id.prev)
and forgot to update the second initialization to R.id.next
.To suppress this error, use the issue id "CutPasteId" as explained in the Suppressing Warnings and Errors section.
DalvikOverride
Disabled By: Default
The Dalvik virtual machine will treat a package private method in one class as overriding a package private method in its super class, even if they are in separate packages.
If you really did intend for this method to override the other, make the method
If you did not intend the override, consider making the method private, or changing its name or signature.
Note that this check is disabled be default, because ART (the successor to Dalvik) no longer has this behavior.
To suppress this error, use the issue id "DalvikOverride" as explained in the Suppressing Warnings and Errors section.
If you really did intend for this method to override the other, make the method
protected
instead.If you did not intend the override, consider making the method private, or changing its name or signature.
Note that this check is disabled be default, because ART (the successor to Dalvik) no longer has this behavior.
To suppress this error, use the issue id "DalvikOverride" as explained in the Suppressing Warnings and Errors section.
DefaultLocale
Disabled By: Project lint.xml file
Calling
If you want the methods to just perform ASCII replacement, for example to convert an enum name, call
To suppress this error, use the issue id "DefaultLocale" as explained in the Suppressing Warnings and Errors section.
String#toLowerCase()
or #toUpperCase()
without specifying an explicit locale is a common source of bugs. The reason for that is that those methods will use the current locale on the user's device, and even though the code appears to work correctly when you are developing the app, it will fail in some locales. For example, in the Turkish locale, the uppercase replacement for i
is not I
.If you want the methods to just perform ASCII replacement, for example to convert an enum name, call
String#toUpperCase(Locale.US)
instead. If you really want to use the current locale, call String#toUpperCase(Locale.getDefault())
instead.To suppress this error, use the issue id "DefaultLocale" as explained in the Suppressing Warnings and Errors section.
DeletedProvider
Disabled By: Project lint.xml file
The
To suppress this error, use the issue id "DeletedProvider" as explained in the Suppressing Warnings and Errors section.
Crypto
provider has been completely removed in Android P (and was deprecated in an earlier release). This means that the code will throw a NoSuchProviderException
and the app will crash. Even if the code catches that exception at a higher level, this is not secure and should not be used.To suppress this error, use the issue id "DeletedProvider" as explained in the Suppressing Warnings and Errors section.
Deprecated
Disabled By: Project lint.xml file
Deprecated views, attributes and so on are deprecated because there is a better way to do something. Do it that new way. You've been warned.
To suppress this error, use the issue id "Deprecated" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "Deprecated" as explained in the Suppressing Warnings and Errors section.
DeprecatedProvider
Disabled By: Project lint.xml file
The
To suppress this error, use the issue id "DeprecatedProvider" as explained in the Suppressing Warnings and Errors section.
BC
provider has been deprecated and will not be provided when targetSdkVersion
is P or higher.To suppress this error, use the issue id "DeprecatedProvider" as explained in the Suppressing Warnings and Errors section.
DevModeObsolete
Disabled By: Project lint.xml file
In the past, our documentation recommended creating a
That workaround is no longer necessary, and it has some serious downsides, such as breaking API access checking (since the true
In recent versions of the IDE and the Gradle plugin, the IDE automatically passes the API level of the connected device used for deployment, and if that device is at least API 21, then multidexing is automatically turned on, meaning that you get the same speed benefits as the
To suppress this error, use the issue id "DevModeObsolete" as explained in the Suppressing Warnings and Errors section.
dev
product flavor with has a minSdkVersion of 21, in order to enable multidexing to speed up builds significantly during development.That workaround is no longer necessary, and it has some serious downsides, such as breaking API access checking (since the true
minSdkVersion
is no longer known).In recent versions of the IDE and the Gradle plugin, the IDE automatically passes the API level of the connected device used for deployment, and if that device is at least API 21, then multidexing is automatically turned on, meaning that you get the same speed benefits as the
dev
product flavor but without the downsides.To suppress this error, use the issue id "DevModeObsolete" as explained in the Suppressing Warnings and Errors section.
DeviceAdmin
Disabled By: Project lint.xml file
If you register a broadcast receiver which acts as a device admin, you must also register an
To do this, add
to your
To suppress this error, use the issue id "DeviceAdmin" as explained in the Suppressing Warnings and Errors section.
<intent-filter>
for the action android.app.action.DEVICE_ADMIN_ENABLED
, without any <data>
, such that the device admin can be activated/deactivated.To do this, add
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
to your
<receiver>
.To suppress this error, use the issue id "DeviceAdmin" as explained in the Suppressing Warnings and Errors section.
DisableBaselineAlignment
Disabled By: Project lint.xml file
When a LinearLayout is used to distribute the space proportionally between nested layouts, the baseline alignment property should be turned off to make the layout computation faster.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "DisableBaselineAlignment" 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 "DisableBaselineAlignment" as explained in the Suppressing Warnings and Errors section.
DrawAllocation
Disabled By: Project lint.xml file
You should avoid allocating objects during a drawing or layout operation. These are called frequently, so a smooth UI can be interrupted by garbage collection pauses caused by the object allocations.
The way this is generally handled is to allocate the needed objects up front and to reuse them for each drawing operation.
Some methods allocate memory on your behalf (such as
To suppress this error, use the issue id "DrawAllocation" as explained in the Suppressing Warnings and Errors section.
The way this is generally handled is to allocate the needed objects up front and to reuse them for each drawing operation.
Some methods allocate memory on your behalf (such as
Bitmap.create
), and these should be handled in the same way.To suppress this error, use the issue id "DrawAllocation" as explained in the Suppressing Warnings and Errors section.
DuplicateDefinition
Disabled By: Project lint.xml file
You can define a resource multiple times in different resource folders; that's how string translations are done, for example. However, defining the same resource more than once in the same resource folder is likely an error, for example attempting to add a new resource without realizing that the name is already used, and so on.
To suppress this error, use the issue id "DuplicateDefinition" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "DuplicateDefinition" as explained in the Suppressing Warnings and Errors section.
DuplicateDivider
Disabled By: Project lint.xml file
Older versions of the RecyclerView library did not include a divider decorator, but one was provided as a sample in the support demos. This divider class has been widely copy/pasted into various projects.
In recent versions of the support library, the divider decorator is now included, so you can replace custom copies with the "built-in" version,
To suppress this error, use the issue id "DuplicateDivider" as explained in the Suppressing Warnings and Errors section.
In recent versions of the support library, the divider decorator is now included, so you can replace custom copies with the "built-in" version,
android.support.v7.widget.DividerItemDecoration
.To suppress this error, use the issue id "DuplicateDivider" as explained in the Suppressing Warnings and Errors section.
DuplicateIncludedIds
Disabled By: Project lint.xml file
It's okay for two independent layouts to use the same ids. However, if layouts are combined with include tags, then the id's need to be unique within any chain of included layouts, or
To suppress this error, use the issue id "DuplicateIncludedIds" as explained in the Suppressing Warnings and Errors section.
Activity#findViewById()
can return an unexpected view.To suppress this error, use the issue id "DuplicateIncludedIds" as explained in the Suppressing Warnings and Errors section.
DuplicateStrings
Disabled By: Default
Duplicate strings can make applications larger unnecessarily.
This lint check looks for duplicate strings, including differences for strings where the only difference is in capitalization. Title casing and all uppercase can all be adjusted in the layout or in code.
This lint check looks for duplicate strings, including differences for strings where the only difference is in capitalization. Title casing and all uppercase can all be adjusted in the layout or in code.
More info: https://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType
To suppress this error, use the issue id "DuplicateStrings" as explained in the Suppressing Warnings and Errors section.DuplicateUsesFeature
Disabled By: Project lint.xml file
A given feature should only be declared once in the manifest.
To suppress this error, use the issue id "DuplicateUsesFeature" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "DuplicateUsesFeature" as explained in the Suppressing Warnings and Errors section.
EasterEgg
Disabled By: Default
An "easter egg" is code deliberately hidden in the code, both from potential users and even from other developers. This lint check looks for code which looks like it may be hidden from sight.
To suppress this error, use the issue id "EasterEgg" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "EasterEgg" as explained in the Suppressing Warnings and Errors section.
EllipsizeMaxLines
Disabled By: Project lint.xml file
Combining
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "EllipsizeMaxLines" as explained in the Suppressing Warnings and Errors section.
ellipsize
and maxLines=1
can lead to crashes on some devices. Earlier versions of lint recommended replacing singleLine=true
with maxLines=1
but that should not be done when using ellipsize
.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "EllipsizeMaxLines" as explained in the Suppressing Warnings and Errors section.
EnqueueWork
Disabled By: Project lint.xml file
To suppress this error, use the issue id "EnqueueWork" as explained in the Suppressing Warnings and Errors section.
WorkContinuations
cannot be enqueued automatically. You must call enqueue()
on a WorkContinuation
to have it and its parent continuations enqueued inside WorkManager
.To suppress this error, use the issue id "EnqueueWork" as explained in the Suppressing Warnings and Errors section.
ExifInterface
Disabled By: Project lint.xml file
The
To suppress this error, use the issue id "ExifInterface" as explained in the Suppressing Warnings and Errors section.
android.media.ExifInterface
implementation has some known security bugs in older versions of Android. There is a new implementation available of this library in the support library, which is preferable.To suppress this error, use the issue id "ExifInterface" as explained in the Suppressing Warnings and Errors section.
ExpiringTargetSdkVersion
Disabled By: Project lint.xml file
In the second half of 2018, Google Play will require that new apps and app updates target API level 26 or higher. This will be required for new apps in August 2018, and for updates to existing apps in November 2018.
Configuring your app to target a recent API level ensures that users benefit from significant security and performance improvements, while still allowing your app to run on older Android versions (down to the
This lint check starts warning you some months before these changes go into effect if your
To update your
https://developer.android.com/distribute/best-practices/develop/target-sdk.html
Configuring your app to target a recent API level ensures that users benefit from significant security and performance improvements, while still allowing your app to run on older Android versions (down to the
minSdkVersion
).This lint check starts warning you some months before these changes go into effect if your
targetSdkVersion
is 25 or lower. This is intended to give you a heads up to update your app, since depending on your current targetSdkVersion
the work can be nontrivial.To update your
targetSdkVersion
, follow the steps from "Meeting Google Play requirements for target API level",https://developer.android.com/distribute/best-practices/develop/target-sdk.html
More info:
To suppress this error, use the issue id "ExpiringTargetSdkVersion" as explained in the Suppressing Warnings and Errors section.ExportedContentProvider
Disabled By: Project lint.xml file
Content providers are exported by default and any application on the system can potentially use them to read and write data. If the content provider provides access to sensitive data, it should be protected by specifying
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ExportedContentProvider" as explained in the Suppressing Warnings and Errors section.
export=false
in the manifest or by protecting it with a permission that can be granted to other applications.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ExportedContentProvider" as explained in the Suppressing Warnings and Errors section.

To suppress this error, use the issue id "ExportedPreferenceActivity" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "ExportedPreferenceActivity" as explained in the Suppressing Warnings and Errors section.
ExportedReceiver
Disabled By: Project lint.xml file
Exported receivers (receivers which either set
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ExportedReceiver" as explained in the Suppressing Warnings and Errors section.
exported=true
or contain an intent-filter and do not specify exported=false
) should define a permission that an entity must have in order to launch the receiver or bind to it. Without this, any application can use this receiver.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ExportedReceiver" as explained in the Suppressing Warnings and Errors section.
ExportedService
Disabled By: Project lint.xml file
Exported services (services which either set
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ExportedService" as explained in the Suppressing Warnings and Errors section.
exported=true
or contain an intent-filter and do not specify exported=false
) should define a permission that an entity must have in order to launch the service or bind to it. Without this, any application can use this service.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "ExportedService" as explained in the Suppressing Warnings and Errors section.
ExtraText
Disabled By: Project lint.xml file
Layout resource files should only contain elements and attributes. Any XML text content found in the file is likely accidental (and potentially dangerous if the text resembles XML and the developer believes the text to be functional)
To suppress this error, use the issue id "ExtraText" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "ExtraText" as explained in the Suppressing Warnings and Errors section.
FieldGetter
Disabled By: Default
Accessing a field within the class that defines a getter for that field is at least 3 times faster than calling the getter. For simple getters that do nothing other than return the field, you might want to just reference the local field directly instead.
NOTE: As of Android 2.3 (Gingerbread), this optimization is performed automatically by Dalvik, so there is no need to change your code; this is only relevant if you are targeting older versions of Android.
To suppress this error, use the issue id "FieldGetter" as explained in the Suppressing Warnings and Errors section.
NOTE: As of Android 2.3 (Gingerbread), this optimization is performed automatically by Dalvik, so there is no need to change your code; this is only relevant if you are targeting older versions of Android.
To suppress this error, use the issue id "FieldGetter" as explained in the Suppressing Warnings and Errors section.
FindViewByIdCast
Disabled By: Project lint.xml file
In Android O, the
However, due to language changes between Java 7 and 8, this change may cause code to not compile without explicit casts. This lint check looks for these scenarios and suggests casts to be added now such that the code will continue to compile if the language level is updated to 1.8.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "FindViewByIdCast" as explained in the Suppressing Warnings and Errors section.
findViewById
signature switched to using generics, which means that most of the time you can leave out explicit casts and just assign the result of the findViewById
call to variables of specific view classes.However, due to language changes between Java 7 and 8, this change may cause code to not compile without explicit casts. This lint check looks for these scenarios and suggests casts to be added now such that the code will continue to compile if the language level is updated to 1.8.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "FindViewByIdCast" as explained in the Suppressing Warnings and Errors section.
FloatMath
Disabled By: Project lint.xml file
In older versions of Android, using
To suppress this error, use the issue id "FloatMath" as explained in the Suppressing Warnings and Errors section.
android.util.FloatMath
was recommended for performance reasons when operating on floats. However, on modern hardware doubles are just as fast as float (though they take more memory), and in recent versions of Android, FloatMath
is actually slower than using java.lang.Math
due to the way the JIT optimizes java.lang.Math
. Therefore, you should use Math
instead of FloatMath
if you are only targeting Froyo and above.To suppress this error, use the issue id "FloatMath" as explained in the Suppressing Warnings and Errors section.
FontValidationError
Disabled By: Project lint.xml file
Look for problems in various font files.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "FontValidationError" 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 "FontValidationError" as explained in the Suppressing Warnings and Errors section.
FontValidationWarning
Disabled By: Project lint.xml file
Look for problems in various font files.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "FontValidationWarning" 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 "FontValidationWarning" as explained in the Suppressing Warnings and Errors section.
GetContentDescriptionOverride
Disabled By: Project lint.xml file
Overriding
To suppress this error, use the issue id "GetContentDescriptionOverride" as explained in the Suppressing Warnings and Errors section.
getContentDescription()
may prevent some accessibility services from properly navigating content exposed by your view. Instead, call setContentDescription()
when the content description needs to be changed.To suppress this error, use the issue id "GetContentDescriptionOverride" as explained in the Suppressing Warnings and Errors section.
GetInstance
Disabled By: Project lint.xml file
To suppress this error, use the issue id "GetInstance" as explained in the Suppressing Warnings and Errors section.
Cipher#getInstance
should not be called with ECB as the cipher mode or without setting the cipher mode because the default mode on android is ECB, which is insecure.To suppress this error, use the issue id "GetInstance" as explained in the Suppressing Warnings and Errors section.
GetLocales
Disabled By: Project lint.xml file
This check looks for usage of Lollipop-style locale folders (e.g. 3 letter language codes, or BCP 47 qualifiers) combined with an
To suppress this error, use the issue id "GetLocales" as explained in the Suppressing Warnings and Errors section.
AssetManager#getLocales()
call. This leads to crashesTo suppress this error, use the issue id "GetLocales" as explained in the Suppressing Warnings and Errors section.
GifUsage
Disabled By: Project lint.xml file
The
To suppress this error, use the issue id "GifUsage" as explained in the Suppressing Warnings and Errors section.
.gif
file format is discouraged. Consider using .png
(preferred) or .jpg
(acceptable) instead.To suppress this error, use the issue id "GifUsage" as explained in the Suppressing Warnings and Errors section.
GoogleAppIndexingApiWarning
Disabled By: Default
Adds URLs to get your app into the Google index, to get installs and traffic to your app from Google Search.
To suppress this error, use the issue id "GoogleAppIndexingApiWarning" as explained in the Suppressing Warnings and Errors section.
More info: https://g.co/AppIndexing/AndroidStudio
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "GoogleAppIndexingApiWarning" as explained in the Suppressing Warnings and Errors section.
GoogleAppIndexingWarning
Disabled By: Project lint.xml file
Adds URLs to get your app into the Google index, to get installs and traffic to your app from Google Search.
To suppress this error, use the issue id "GoogleAppIndexingWarning" as explained in the Suppressing Warnings and Errors section.
More info: https://g.co/AppIndexing/AndroidStudio
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "GoogleAppIndexingWarning" as explained in the Suppressing Warnings and Errors section.
GradleDependency
Disabled By: Project lint.xml file
This detector looks for usages of libraries where the version you are using is not the current stable release. Using older versions is fine, and there are cases where you deliberately want to stick with an older version. However, you may simply not be aware that a more recent version is available, and that is what this lint check helps find.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "GradleDependency" 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 "GradleDependency" as explained in the Suppressing Warnings and Errors section.
GradleDeprecated
Disabled By: Project lint.xml file
This detector looks for deprecated Gradle constructs which currently work but will likely stop working in a future update.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "GradleDeprecated" 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 "GradleDeprecated" as explained in the Suppressing Warnings and Errors section.
GradleDynamicVersion
Disabled By: Project lint.xml file
Using
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "GradleDynamicVersion" as explained in the Suppressing Warnings and Errors section.
+
in dependencies lets you automatically pick up the latest available version rather than a specific, named version. However, this is not recommended; your builds are not repeatable; you may have tested with a slightly different version than what the build server used. (Using a dynamic version as the major version number is more problematic than using it in the minor version position.)Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "GradleDynamicVersion" as explained in the Suppressing Warnings and Errors section.
GradleGetter
Disabled By: Project lint.xml file
Gradle will let you replace specific constants in your build scripts with method calls, so you can for example dynamically compute a version string based on your current version control revision number, rather than hardcoding a number.
When computing a version name, it's tempting to for example call the method to do that
To suppress this error, use the issue id "GradleGetter" as explained in the Suppressing Warnings and Errors section.
When computing a version name, it's tempting to for example call the method to do that
getVersionName
. However, when you put that method call inside the defaultConfig
block, you will actually be calling the Groovy getter for the versionName
property instead. Therefore, you need to name your method something which does not conflict with the existing implicit getters. Consider using compute
as a prefix instead of get
.To suppress this error, use the issue id "GradleGetter" as explained in the Suppressing Warnings and Errors section.
GradleIdeError
Disabled By: Project lint.xml file
Gradle is highly flexible, and there are things you can do in Gradle files which can make it hard or impossible for IDEs to properly handle the project. This lint check looks for constructs that potentially break IDE support.
To suppress this error, use the issue id "GradleIdeError" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "GradleIdeError" as explained in the Suppressing Warnings and Errors section.
GradleOverrides
Disabled By: Project lint.xml file
The value of (for example)
To suppress this error, use the issue id "GradleOverrides" as explained in the Suppressing Warnings and Errors section.
minSdkVersion
is only used if it is not specified in the build.gradle
build scripts. When specified in the Gradle build scripts, the manifest value is ignored and can be misleading, so should be removed to avoid ambiguity.To suppress this error, use the issue id "GradleOverrides" as explained in the Suppressing Warnings and Errors section.
GradlePath
Disabled By: Project lint.xml file
Gradle build scripts are meant to be cross platform, so file paths use Unix-style path separators (a forward slash) rather than Windows path separators (a backslash). Similarly, to keep projects portable and repeatable, avoid using absolute paths on the system; keep files within the project instead. To share code between projects, consider creating an android-library and an AAR dependency
To suppress this error, use the issue id "GradlePath" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "GradlePath" as explained in the Suppressing Warnings and Errors section.
GradlePluginVersion
Disabled By: Project lint.xml file
Not all versions of the Android Gradle plugin are compatible with all versions of the SDK. If you update your tools, or if you are trying to open a project that was built with an old version of the tools, you may need to update your plugin version number.
To suppress this error, use the issue id "GradlePluginVersion" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "GradlePluginVersion" as explained in the Suppressing Warnings and Errors section.
GrantAllUris
Disabled By: Project lint.xml file
The
To suppress this error, use the issue id "GrantAllUris" as explained in the Suppressing Warnings and Errors section.
<grant-uri-permission>
element allows specific paths to be shared. This detector checks for a path URL of just '/' (everything), which is probably not what you want; you should limit access to a subset.To suppress this error, use the issue id "GrantAllUris" as explained in the Suppressing Warnings and Errors section.
HalfFloat
Disabled By: Project lint.xml file
Half-precision floating point are stored in a short data type, and should be manipulated using the
To suppress this error, use the issue id "HalfFloat" as explained in the Suppressing Warnings and Errors section.
android.util.Half
class. This check flags usages where it appears that these values are used incorrectly.To suppress this error, use the issue id "HalfFloat" as explained in the Suppressing Warnings and Errors section.
HandlerLeak
Disabled By: Project lint.xml file
Since this Handler is declared as an inner class, it may prevent the outer class from being garbage collected. If the Handler is using a Looper or MessageQueue for a thread other than the main thread, then there is no issue. If the Handler is using the Looper or MessageQueue of the main thread, you need to fix your Handler declaration, as follows: Declare the Handler as a static class; In the outer class, instantiate a WeakReference to the outer class and pass this object to your Handler when you instantiate the Handler; Make all references to members of the outer class using the WeakReference object.
To suppress this error, use the issue id "HandlerLeak" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "HandlerLeak" as explained in the Suppressing Warnings and Errors section.
HardcodedText
Disabled By: Project lint.xml file
Hardcoding text attributes directly in layout files is bad for several reasons:
* When creating configuration variations (for example for landscape or portrait) you have to repeat the actual text (and keep it up to date when making changes)
* The application cannot be translated to other languages by just adding new translations for existing string resources.
There are quickfixes to automatically extract this hardcoded string into a resource lookup.
To suppress this error, use the issue id "HardcodedText" as explained in the Suppressing Warnings and Errors section.
* When creating configuration variations (for example for landscape or portrait) you have to repeat the actual text (and keep it up to date when making changes)
* The application cannot be translated to other languages by just adding new translations for existing string resources.
There are quickfixes to automatically extract this hardcoded string into a resource lookup.
To suppress this error, use the issue id "HardcodedText" as explained in the Suppressing Warnings and Errors section.
HardwareIds
Disabled By: Project lint.xml file
Using these device identifiers is not recommended other than for high value fraud prevention and advanced telephony use-cases. For advertising use-cases, use
To suppress this error, use the issue id "HardwareIds" as explained in the Suppressing Warnings and Errors section.
AdvertisingIdClient$Info#getId
and for analytics, use InstanceId#getId
.To suppress this error, use the issue id "HardwareIds" as explained in the Suppressing Warnings and Errors section.
HighAppVersionCode
Disabled By: Project lint.xml file
The declared
To suppress this error, use the issue id "HighAppVersionCode" as explained in the Suppressing Warnings and Errors section.
versionCode
is an Integer. Ensure that the version number is not close to the limit. It is recommended to monotonically increase this number each minor or major release of the app. Note that updating an app with a versionCode over Integer.MAX_VALUE
is not possible.To suppress this error, use the issue id "HighAppVersionCode" as explained in the Suppressing Warnings and Errors section.
IconColors
Disabled By: Project lint.xml file
Notification icons and Action Bar icons should only white and shades of gray. See the Android Design Guide for more details. Note that the way Lint decides whether an icon is an action bar icon or a notification icon is based on the filename prefix:
To suppress this error, use the issue id "IconColors" as explained in the Suppressing Warnings and Errors section.
ic_menu_
for action bar icons, ic_stat_
for notification icons etc. These correspond to the naming conventions documented in http://developer.android.com/guide/practices/ui_guidelines/icon_design.htmlTo suppress this error, use the issue id "IconColors" as explained in the Suppressing Warnings and Errors section.
IconDensities
Disabled By: Project lint.xml file
Icons will look best if a custom version is provided for each of the major screen density classes (low, medium, high, extra high). This lint check identifies icons which do not have complete coverage across the densities.
Low density is not really used much anymore, so this check ignores the ldpi density. To force lint to include it, set the environment variable
To suppress this error, use the issue id "IconDensities" as explained in the Suppressing Warnings and Errors section.
Low density is not really used much anymore, so this check ignores the ldpi density. To force lint to include it, set the environment variable
ANDROID_LINT_INCLUDE_LDPI=true
. For more information on current density usage, see http://developer.android.com/resources/dashboard/screens.htmlTo suppress this error, use the issue id "IconDensities" as explained in the Suppressing Warnings and Errors section.
IconDipSize
Disabled By: Project lint.xml file
Checks the all icons which are provided in multiple densities, all compute to roughly the same density-independent pixel (
To suppress this error, use the issue id "IconDipSize" as explained in the Suppressing Warnings and Errors section.
dip
) size. This catches errors where images are either placed in the wrong folder, or icons are changed to new sizes but some folders are forgotten.To suppress this error, use the issue id "IconDipSize" as explained in the Suppressing Warnings and Errors section.
IconDuplicates
Disabled By: Project lint.xml file
If an icon is repeated under different names, you can consolidate and just use one of the icons and delete the others to make your application smaller. However, duplicated icons usually are not intentional and can sometimes point to icons that were accidentally overwritten or accidentally not updated.
To suppress this error, use the issue id "IconDuplicates" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "IconDuplicates" as explained in the Suppressing Warnings and Errors section.
IconDuplicatesConfig
Disabled By: Project lint.xml file
If an icon is provided under different configuration parameters such as
To suppress this error, use the issue id "IconDuplicatesConfig" as explained in the Suppressing Warnings and Errors section.
drawable-hdpi
or -v11
, they should typically be different. This detector catches cases where the same icon is provided in different configuration folder which is usually not intentional.To suppress this error, use the issue id "IconDuplicatesConfig" as explained in the Suppressing Warnings and Errors section.
IconExpectedSize
Disabled By: Default
There are predefined sizes (for each density) for launcher icons. You should follow these conventions to make sure your icons fit in with the overall look of the platform.
To suppress this error, use the issue id "IconExpectedSize" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "IconExpectedSize" as explained in the Suppressing Warnings and Errors section.
IconExtension
Disabled By: Project lint.xml file
Ensures that icons have the correct file extension (e.g. a
To suppress this error, use the issue id "IconExtension" as explained in the Suppressing Warnings and Errors section.
.png
file is really in the PNG format and not for example a GIF file named .png
).To suppress this error, use the issue id "IconExtension" as explained in the Suppressing Warnings and Errors section.
IconLauncherShape
Disabled By: Project lint.xml file
According to the Android Design Guide (http://developer.android.com/design/style/iconography.html) your launcher icons should "use a distinct silhouette", a "three-dimensional, front view, with a slight perspective as if viewed from above, so that users perceive some depth."
The unique silhouette implies that your launcher icon should not be a filled square.
To suppress this error, use the issue id "IconLauncherShape" as explained in the Suppressing Warnings and Errors section.
The unique silhouette implies that your launcher icon should not be a filled square.
To suppress this error, use the issue id "IconLauncherShape" as explained in the Suppressing Warnings and Errors section.
IconLocation
Disabled By: Project lint.xml file
The res/drawable folder is intended for density-independent graphics such as shapes defined in XML. For bitmaps, move it to
To suppress this error, use the issue id "IconLocation" as explained in the Suppressing Warnings and Errors section.
drawable-mdpi
and consider providing higher and lower resolution versions in drawable-ldpi
, drawable-hdpi
and drawable-xhdpi
. If the icon really is density independent (for example a solid color) you can place it in drawable-nodpi
.To suppress this error, use the issue id "IconLocation" as explained in the Suppressing Warnings and Errors section.
IconMissingDensityFolder
Disabled By: Project lint.xml file
Icons will look best if a custom version is provided for each of the major screen density classes (low, medium, high, extra-high, extra-extra-high). This lint check identifies folders which are missing, such as
Low density is not really used much anymore, so this check ignores the ldpi density. To force lint to include it, set the environment variable
To suppress this error, use the issue id "IconMissingDensityFolder" as explained in the Suppressing Warnings and Errors section.
drawable-hdpi
.Low density is not really used much anymore, so this check ignores the ldpi density. To force lint to include it, set the environment variable
ANDROID_LINT_INCLUDE_LDPI=true
. For more information on current density usage, see http://developer.android.com/resources/dashboard/screens.htmlTo suppress this error, use the issue id "IconMissingDensityFolder" as explained in the Suppressing Warnings and Errors section.
IconMixedNinePatch
Disabled By: Project lint.xml file
If you accidentally name two separate resources
To suppress this error, use the issue id "IconMixedNinePatch" as explained in the Suppressing Warnings and Errors section.
file.png
and file.9.png
, the image file and the nine patch file will both map to the same drawable resource, @drawable/file
, which is probably not what was intended.To suppress this error, use the issue id "IconMixedNinePatch" as explained in the Suppressing Warnings and Errors section.
IconNoDpi
Disabled By: Project lint.xml file
Bitmaps that appear in
To suppress this error, use the issue id "IconNoDpi" as explained in the Suppressing Warnings and Errors section.
drawable-nodpi
folders will not be scaled by the Android framework. If a drawable resource of the same name appears both in a -nodpi
folder as well as a dpi folder such as drawable-hdpi
, then the behavior is ambiguous and probably not intentional. Delete one or the other, or use different names for the icons.To suppress this error, use the issue id "IconNoDpi" as explained in the Suppressing Warnings and Errors section.
IconXmlAndPng
Disabled By: Project lint.xml file
If a drawable resource appears as an
To suppress this error, use the issue id "IconXmlAndPng" as explained in the Suppressing Warnings and Errors section.
.xml
file in the drawable/
folder, it's usually not intentional for it to also appear as a bitmap using the same name; generally you expect the drawable XML file to define states and each state has a corresponding drawable bitmap.To suppress this error, use the issue id "IconXmlAndPng" as explained in the Suppressing Warnings and Errors section.
IllegalResourceRef
Disabled By: Project lint.xml file
For the
To suppress this error, use the issue id "IllegalResourceRef" as explained in the Suppressing Warnings and Errors section.
versionCode
attribute, you have to specify an actual integer literal; you cannot use an indirection with a @dimen/name
resource. Similarly, the versionName
attribute should be an actual string, not a string resource url.To suppress this error, use the issue id "IllegalResourceRef" as explained in the Suppressing Warnings and Errors section.
ImpliedQuantity
Disabled By: Project lint.xml file
Plural strings should generally include a
In these locales, it is usually an error to have a message which does not include a formatting argument (such as '%d'), since it will not be clear from the grammar what quantity the quantity string is describing.
To suppress this error, use the issue id "ImpliedQuantity" as explained in the Suppressing Warnings and Errors section.
%s
or %d
formatting argument. In locales like English, the one
quantity only applies to a single value, 1, but that's not true everywhere. For example, in Slovene, the one
quantity will apply to 1, 101, 201, 301, and so on. Similarly, there are locales where multiple values match the zero
and two
quantities.In these locales, it is usually an error to have a message which does not include a formatting argument (such as '%d'), since it will not be clear from the grammar what quantity the quantity string is describing.
To suppress this error, use the issue id "ImpliedQuantity" as explained in the Suppressing Warnings and Errors section.
ImpliedTouchscreenHardware
Disabled By: Project lint.xml file
Apps require the
To suppress this error, use the issue id "ImpliedTouchscreenHardware" as explained in the Suppressing Warnings and Errors section.
android.hardware.touchscreen
feature by default. If you want your app to be available on TV, you must also explicitly declare that a touchscreen is not required as follows:<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
To suppress this error, use the issue id "ImpliedTouchscreenHardware" as explained in the Suppressing Warnings and Errors section.
InOrMmUsage
Disabled By: Project lint.xml file
Avoid using
While it should work in principle, unfortunately many devices do not report the correct true physical density, which means that the dimension calculations won't work correctly. You are better off using
To suppress this error, use the issue id "InOrMmUsage" as explained in the Suppressing Warnings and Errors section.
mm
(millimeters) or in
(inches) as the unit for dimensions.While it should work in principle, unfortunately many devices do not report the correct true physical density, which means that the dimension calculations won't work correctly. You are better off using
dp
(and for font sizes, sp
).To suppress this error, use the issue id "InOrMmUsage" as explained in the Suppressing Warnings and Errors section.
IncludeLayoutParam
Disabled By: Project lint.xml file
Layout parameters specified on an
To suppress this error, use the issue id "IncludeLayoutParam" as explained in the Suppressing Warnings and Errors section.
<include>
tag will only be used if you also override layout_width
and layout_height
on the <include>
tag; otherwise they will be ignored.More info: http://stackoverflow.com/questions/2631614/does-android-xml-layouts-include-tag-really-work
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.To suppress this error, use the issue id "IncludeLayoutParam" as explained in the Suppressing Warnings and Errors section.
IncompatibleMediaBrowserServiceCompatVersion
Disabled By: Project lint.xml file
To suppress this error, use the issue id "IncompatibleMediaBrowserServiceCompatVersion" as explained in the Suppressing Warnings and Errors section.
MediaBrowserServiceCompat
from version 23.2.0 to 23.4.0 of the Support v4 Library used private APIs and will not be compatible with future versions of Android beyond Android N. Please upgrade to version 24.0.0 or higher of the Support Library.To suppress this error, use the issue id "IncompatibleMediaBrowserServiceCompatVersion" as explained in the Suppressing Warnings and Errors section.
InconsistentArrays
Disabled By: Project lint.xml file
When an array is translated in a different locale, it should normally have the same number of elements as the original array. When adding or removing elements to an array, it is easy to forget to update all the locales, and this lint warning finds inconsistencies like these.
Note however that there may be cases where you really want to declare a different number of array items in each configuration (for example where the array represents available options, and those options differ for different layout orientations and so on), so use your own judgement to decide if this is really an error.
You can suppress this error type if it finds false errors in your project.
To suppress this error, use the issue id "InconsistentArrays" as explained in the Suppressing Warnings and Errors section.
Note however that there may be cases where you really want to declare a different number of array items in each configuration (for example where the array represents available options, and those options differ for different layout orientations and so on), so use your own judgement to decide if this is really an error.
You can suppress this error type if it finds false errors in your project.
To suppress this error, use the issue id "InconsistentArrays" as explained in the Suppressing Warnings and Errors section.
InconsistentLayout
Disabled By: Project lint.xml file
This check ensures that a layout resource which is defined in multiple resource folders, specifies the same set of widgets.
This finds cases where you have accidentally forgotten to add a widget to all variations of the layout, which could result in a runtime crash for some resource configurations when a
There are cases where this is intentional. For example, you may have a dedicated large tablet layout which adds some extra widgets that are not present in the phone version of the layout. As long as the code accessing the layout resource is careful to handle this properly, it is valid. In that case, you can suppress this lint check for the given extra or missing views, or the whole layout
To suppress this error, use the issue id "InconsistentLayout" as explained in the Suppressing Warnings and Errors section.
This finds cases where you have accidentally forgotten to add a widget to all variations of the layout, which could result in a runtime crash for some resource configurations when a
findViewById()
fails.There are cases where this is intentional. For example, you may have a dedicated large tablet layout which adds some extra widgets that are not present in the phone version of the layout. As long as the code accessing the layout resource is careful to handle this properly, it is valid. In that case, you can suppress this lint check for the given extra or missing views, or the whole layout
To suppress this error, use the issue id "InconsistentLayout" as explained in the Suppressing Warnings and Errors section.
InefficientWeight
Disabled By: Project lint.xml file
When only a single widget in a LinearLayout defines a weight, it is more efficient to assign a width/height of
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "InefficientWeight" as explained in the Suppressing Warnings and Errors section.
0dp
to it since it will absorb all the remaining space anyway. With a declared width/height of 0dp
it does not have to measure its own size first.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "InefficientWeight" as explained in the Suppressing Warnings and Errors section.
InflateParams
Disabled By: Project lint.xml file
When inflating a layout, avoid passing in null as the parent view, since otherwise any layout parameters on the root of the inflated layout will be ignored.
To suppress this error, use the issue id "InflateParams" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "InflateParams" as explained in the Suppressing Warnings and Errors section.
InlinedApi
Disabled By: Project lint.xml file
This check scans through all the Android API field references in the application and flags certain constants, such as static final integers and Strings, which were introduced in later versions. These will actually be copied into the class files rather than being referenced, which means that the value is available even when running on older devices. In some cases that's fine, and in other cases it can result in a runtime crash or incorrect behavior. It depends on the context, so consider the code carefully and decide whether it's safe and can be suppressed or whether the code needs to be guarded.
If you really want to use this API and don't need to support older devices just set the
If your code is deliberately accessing newer APIs, and you have ensured (e.g. with conditional execution) that this code will only ever be called on a supported platform, then you can annotate your class or method with the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "InlinedApi" as explained in the Suppressing Warnings and Errors section.
If you really want to use this API and don't need to support older devices just set the
minSdkVersion
in your build.gradle
or AndroidManifest.xml
files.If your code is deliberately accessing newer APIs, and you have ensured (e.g. with conditional execution) that this code will only ever be called on a supported platform, then you can annotate your class or method with the
@TargetApi
annotation specifying the local minimum SDK to apply, such as @TargetApi(11)
, such that this check considers 11 rather than your manifest file's minimum SDK as the required API level.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "InlinedApi" as explained in the Suppressing Warnings and Errors section.
InnerclassSeparator
Disabled By: Project lint.xml file
When you reference an inner class in a manifest file, you must use '$' instead of '.' as the separator character, i.e. Outer$Inner instead of Outer.Inner.
(If you get this warning for a class which is not actually an inner class, it's because you are using uppercase characters in your package name, which is not conventional.)
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "InnerclassSeparator" as explained in the Suppressing Warnings and Errors section.
(If you get this warning for a class which is not actually an inner class, it's because you are using uppercase characters in your package name, which is not conventional.)
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "InnerclassSeparator" as explained in the Suppressing Warnings and Errors section.
InstantApps
Disabled By: Project lint.xml file
This issue flags code that will not work correctly in Instant Apps
To suppress this error, use the issue id "InstantApps" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "InstantApps" as explained in the Suppressing Warnings and Errors section.
IntentReset
Disabled By: Project lint.xml file
Intent provides the following APIs:
To suppress this error, use the issue id "IntentReset" as explained in the Suppressing Warnings and Errors section.
setData(Uri)
and setType(String)
. Unfortunately, setting one clears the other. If you want to set both, you should call setDataAndType(Uri, String)
instead.To suppress this error, use the issue id "IntentReset" as explained in the Suppressing Warnings and Errors section.
InvalidAnalyticsName
Disabled By: Project lint.xml file
Event names and parameters must follow the naming conventions defined in the`FirebaseAnalytics#logEvent()` documentation.
To suppress this error, use the issue id "InvalidAnalyticsName" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "InvalidAnalyticsName" as explained in the Suppressing Warnings and Errors section.
InvalidImeActionId
Disabled By: Project lint.xml file
android:imeActionId should not be a resourceId such as @+id/resName. It must be an integer constant, or an integer resource reference, as defined in EditorInfo.
To suppress this error, use the issue id "InvalidImeActionId" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "InvalidImeActionId" as explained in the Suppressing Warnings and Errors section.
InvalidNavigation
Disabled By: Project lint.xml file
All
To suppress this error, use the issue id "InvalidNavigation" as explained in the Suppressing Warnings and Errors section.
<navigation>
elements must have a start destination specified, and it must be a direct child of that <navigation>
.To suppress this error, use the issue id "InvalidNavigation" as explained in the Suppressing Warnings and Errors section.
InvalidPackage
Disabled By: Project lint.xml file
This check scans through libraries looking for calls to APIs that are not included in Android.
When you create Android projects, the classpath is set up such that you can only access classes in the API packages that are included in Android. However, if you add other projects to your libs/ folder, there is no guarantee that those .jar files were built with an Android specific classpath, and in particular, they could be accessing unsupported APIs such as java.applet.
This check scans through library jars and looks for references to API packages that are not included in Android and flags these. This is only an error if your code calls one of the library classes which wind up referencing the unsupported package.
To suppress this error, use the issue id "InvalidPackage" as explained in the Suppressing Warnings and Errors section.
When you create Android projects, the classpath is set up such that you can only access classes in the API packages that are included in Android. However, if you add other projects to your libs/ folder, there is no guarantee that those .jar files were built with an Android specific classpath, and in particular, they could be accessing unsupported APIs such as java.applet.
This check scans through library jars and looks for references to API packages that are not included in Android and flags these. This is only an error if your code calls one of the library classes which wind up referencing the unsupported package.
To suppress this error, use the issue id "InvalidPackage" as explained in the Suppressing Warnings and Errors section.
InvalidPermission
Disabled By: Project lint.xml file
Not all elements support the permission attribute. If a permission is set on an invalid element, it is a no-op and ignored. Ensure that this permission attribute was set on the correct element to protect the correct component.
To suppress this error, use the issue id "InvalidPermission" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "InvalidPermission" as explained in the Suppressing Warnings and Errors section.
InvalidResourceFolder
Disabled By: Project lint.xml file
This lint check looks for a folder name that is not a valid resource folder name; these will be ignored and not packaged by the Android Gradle build plugin.
Note that the order of resources is very important; for example, you can't specify a language before a network code.
Similarly, note that to use 3 letter region codes, you have to use a special BCP 47 syntax: the prefix b+ followed by the BCP 47 language tag but with
Note that the order of resources is very important; for example, you can't specify a language before a network code.
Similarly, note that to use 3 letter region codes, you have to use a special BCP 47 syntax: the prefix b+ followed by the BCP 47 language tag but with
+
as the individual separators instead of -
. Therefore, for the BCP 47 language tag nl-ABW
you have to use b+nl+ABW
.More info:
To suppress this error, use the issue id "InvalidResourceFolder" as explained in the Suppressing Warnings and Errors section.InvalidUsesTagAttribute
Disabled By: Project lint.xml file
The <uses> element in
Valid values are
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "InvalidUsesTagAttribute" as explained in the Suppressing Warnings and Errors section.
<automotiveApp>
should contain a valid value for the name
attribute.Valid values are
media
, notification
, or sms
.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "InvalidUsesTagAttribute" as explained in the Suppressing Warnings and Errors section.
InvalidVectorPath
Disabled By: Project lint.xml file
This check ensures that vector paths are valid. For example, it makes sure that the numbers are not using scientific notation (such as 1.0e3) which can lead to runtime crashes on older devices. As another example, it flags numbers like
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "InvalidVectorPath" as explained in the Suppressing Warnings and Errors section.
.5
which should be written as 0.5
instead to avoid crashes on some pre-Marshmallow devices.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "InvalidVectorPath" as explained in the Suppressing Warnings and Errors section.
InvalidWakeLockTag
Disabled By: Project lint.xml file
Wake Lock tags must follow the naming conventions defined in the`PowerManager` documentation.
To suppress this error, use the issue id "InvalidWakeLockTag" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "InvalidWakeLockTag" as explained in the Suppressing Warnings and Errors section.
InvalidWearFeatureAttribute
Disabled By: Project lint.xml file
For the
To suppress this error, use the issue id "InvalidWearFeatureAttribute" as explained in the Suppressing Warnings and Errors section.
android.hardware.type.watch
uses-feature, android:required="false" is disallowed. A single APK for Wear and non-Wear devices is not supported.To suppress this error, use the issue id "InvalidWearFeatureAttribute" as explained in the Suppressing Warnings and Errors section.
JavascriptInterface
Disabled By: Project lint.xml file
As of API 17, you must annotate methods in objects registered with the
To suppress this error, use the issue id "JavascriptInterface" as explained in the Suppressing Warnings and Errors section.
addJavascriptInterface
method with a @JavascriptInterface
annotation.To suppress this error, use the issue id "JavascriptInterface" as explained in the Suppressing Warnings and Errors section.
JobSchedulerService
Disabled By: Project lint.xml file
This check looks for various common mistakes in using the JobScheduler API: the service class must extend
To suppress this error, use the issue id "JobSchedulerService" as explained in the Suppressing Warnings and Errors section.
JobService
, the service must be registered in the manifest and the registration must require the permission android.permission.BIND_JOB_SERVICE
.To suppress this error, use the issue id "JobSchedulerService" as explained in the Suppressing Warnings and Errors section.
KeyboardInaccessibleWidget
Disabled By: Project lint.xml file
A widget that is declared to be clickable but not declared to be focusable is not accessible via the keyboard. Please add the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "KeyboardInaccessibleWidget" as explained in the Suppressing Warnings and Errors section.
focusable
attribute as well.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "KeyboardInaccessibleWidget" as explained in the Suppressing Warnings and Errors section.
KotlinPropertyAccess
Disabled By: Default
For a method to be represented as a property in Kotlin, strict “bean”-style prefixing must be used.
Accessor methods require a ‘get’ prefix or for boolean-returning methods an ‘is’ prefix can be used.
To suppress this error, use the issue id "KotlinPropertyAccess" as explained in the Suppressing Warnings and Errors section.
Accessor methods require a ‘get’ prefix or for boolean-returning methods an ‘is’ prefix can be used.
To suppress this error, use the issue id "KotlinPropertyAccess" as explained in the Suppressing Warnings and Errors section.
LabelFor
Disabled By: Project lint.xml file
Editable text fields should provide an
When using
If your view is labeled but by a label in a different layout which includes this one, just suppress this warning from lint.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "LabelFor" as explained in the Suppressing Warnings and Errors section.
android:hint
or, provided your minSdkVersion
is at least 17, they may be referenced by a view with a android:labelFor
attribute.When using
android:labelFor
, be sure to provide an android:text
or an android:contentDescription
.If your view is labeled but by a label in a different layout which includes this one, just suppress this warning from lint.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "LabelFor" as explained in the Suppressing Warnings and Errors section.
LambdaLast
Disabled By: Default
To improve calling this code from Kotlin,
parameter types eligible for SAM conversion should be last.
To suppress this error, use the issue id "LambdaLast" as explained in the Suppressing Warnings and Errors section.
parameter types eligible for SAM conversion should be last.
To suppress this error, use the issue id "LambdaLast" as explained in the Suppressing Warnings and Errors section.
LocalSuppress
Disabled By: Project lint.xml file
The
To suppress this error, use the issue id "LocalSuppress" as explained in the Suppressing Warnings and Errors section.
@SuppressAnnotation
is used to suppress Lint warnings in Java files. However, while many lint checks analyzes the Java source code, where they can find annotations on (for example) local variables, some checks are analyzing the .class
files. And in class files, annotations only appear on classes, fields and methods. Annotations placed on local variables disappear. If you attempt to suppress a lint error for a class-file based lint check, the suppress annotation not work. You must move the annotation out to the surrounding method.To suppress this error, use the issue id "LocalSuppress" as explained in the Suppressing Warnings and Errors section.
LocaleFolder
Disabled By: Project lint.xml file
From the
"Note that Java uses several deprecated two-letter codes. The Hebrew ("he") language code is rewritten as "iw", Indonesian ("id") as "in", and Yiddish ("yi") as "ji". This rewriting happens even if you construct your own Locale object, not just for instances returned by the various lookup methods.
Because of this, if you add your localized resources in for example
To work around this, place your resources in a
To suppress this error, use the issue id "LocaleFolder" as explained in the Suppressing Warnings and Errors section.
java.util.Locale
documentation:"Note that Java uses several deprecated two-letter codes. The Hebrew ("he") language code is rewritten as "iw", Indonesian ("id") as "in", and Yiddish ("yi") as "ji". This rewriting happens even if you construct your own Locale object, not just for instances returned by the various lookup methods.
Because of this, if you add your localized resources in for example
values-he
they will not be used, since the system will look for values-iw
instead.To work around this, place your resources in a
values
folder using the deprecated language code instead.To suppress this error, use the issue id "LocaleFolder" as explained in the Suppressing Warnings and Errors section.
LogConditional
Disabled By: Default
The BuildConfig class (available in Tools 17) provides a constant, "DEBUG", which indicates whether the code is being built in release mode or in debug mode. In release mode, you typically want to strip out all the logging calls. Since the compiler will automatically remove all code which is inside a "if (false)" check, surrounding your logging calls with a check for BuildConfig.DEBUG is a good idea.
If you really intend for the logging to be present in release mode, you can suppress this warning with a @SuppressLint annotation for the intentional logging calls.
To suppress this error, use the issue id "LogConditional" as explained in the Suppressing Warnings and Errors section.
If you really intend for the logging to be present in release mode, you can suppress this warning with a @SuppressLint annotation for the intentional logging calls.
To suppress this error, use the issue id "LogConditional" as explained in the Suppressing Warnings and Errors section.
LogTagMismatch
Disabled By: Project lint.xml file
When guarding a
To suppress this error, use the issue id "LogTagMismatch" as explained in the Suppressing Warnings and Errors section.
Log.v(tag, ...)
call with Log.isLoggable(tag)
, the tag passed to both calls should be the same. Similarly, the level passed in to Log.isLoggable
should typically match the type of Log
call, e.g. if checking level Log.DEBUG
, the corresponding Log
call should be Log.d
, not Log.i
.To suppress this error, use the issue id "LogTagMismatch" as explained in the Suppressing Warnings and Errors section.
LongLogTag
Disabled By: Project lint.xml file
Log tags are only allowed to be at most 23 tag characters long.
To suppress this error, use the issue id "LongLogTag" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "LongLogTag" as explained in the Suppressing Warnings and Errors section.
MangledCRLF
Disabled By: Default
On Windows, line endings are typically recorded as carriage return plus newline: \r\n.
This detector looks for invalid line endings with repeated carriage return characters (without newlines). Previous versions of the ADT plugin could accidentally introduce these into the file, and when editing the file, the editor could produce confusing visual artifacts.
To suppress this error, use the issue id "MangledCRLF" as explained in the Suppressing Warnings and Errors section.
This detector looks for invalid line endings with repeated carriage return characters (without newlines). Previous versions of the ADT plugin could accidentally introduce these into the file, and when editing the file, the editor could produce confusing visual artifacts.
To suppress this error, use the issue id "MangledCRLF" as explained in the Suppressing Warnings and Errors section.
ManifestOrder
Disabled By: Project lint.xml file
The <application> tag should appear after the elements which declare which version you need, which features you need, which libraries you need, and so on. In the past there have been subtle bugs (such as themes not getting applied correctly) when the
To suppress this error, use the issue id "ManifestOrder" as explained in the Suppressing Warnings and Errors section.
<application>
tag appears before some of these other elements, so it's best to order your manifest in the logical dependency order.To suppress this error, use the issue id "ManifestOrder" as explained in the Suppressing Warnings and Errors section.
MenuTitle
Disabled By: Project lint.xml file
From the action bar documentation:
"It's important that you always define android:title for each menu item — even if you don't declare that the title appear with the action item — for three reasons:
* If there's not enough room in the action bar for the action item, the menu item appears in the overflow menu and only the title appears.
* Screen readers for sight-impaired users read the menu item's title.
* If the action item appears with only the icon, a user can long-press the item to reveal a tool-tip that displays the action item's title.
The android:icon is always optional, but recommended.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MenuTitle" as explained in the Suppressing Warnings and Errors section.
"It's important that you always define android:title for each menu item — even if you don't declare that the title appear with the action item — for three reasons:
* If there's not enough room in the action bar for the action item, the menu item appears in the overflow menu and only the title appears.
* Screen readers for sight-impaired users read the menu item's title.
* If the action item appears with only the icon, a user can long-press the item to reveal a tool-tip that displays the action item's title.
The android:icon is always optional, but recommended.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MenuTitle" as explained in the Suppressing Warnings and Errors section.
MergeMarker
Disabled By: Project lint.xml file
Many version control systems leave unmerged files with markers such as <<< in the source code. This check looks for these markers, which are sometimes accidentally left in, particularly in resource files where they don't break compilation.
To suppress this error, use the issue id "MergeMarker" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "MergeMarker" as explained in the Suppressing Warnings and Errors section.
MergeRootFrame
Disabled By: Project lint.xml file
If a
To suppress this error, use the issue id "MergeRootFrame" as explained in the Suppressing Warnings and Errors section.
<FrameLayout>
is the root of a layout and does not provide background or padding etc, it can often be replaced with a <merge>
tag which is slightly more efficient. Note that this depends on context, so make sure you understand how the <merge>
tag works before proceeding.To suppress this error, use the issue id "MergeRootFrame" as explained in the Suppressing Warnings and Errors section.
MinSdkTooLow
Disabled By: Default
The value of the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MinSdkTooLow" as explained in the Suppressing Warnings and Errors section.
minSdkVersion
property is too low and can be incremented without noticeably reducing the number of supported devices.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MinSdkTooLow" as explained in the Suppressing Warnings and Errors section.
MipmapIcons
Disabled By: Project lint.xml file
Launcher icons should be provided in the
In certain cases, the Launcher app may use a higher resolution asset (than would normally be computed for the device) to display large app shortcuts. If drawables for densities other than the device's resolution have been stripped out, then the app shortcut could appear blurry.
To fix this, move your launcher icons from `drawable-`dpi to `mipmap-`dpi and change references from @drawable/ and R.drawable to @mipmap/ and R.mipmap.
In Android Studio this lint warning has a quickfix to perform this automatically.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MipmapIcons" as explained in the Suppressing Warnings and Errors section.
mipmap
resource directory. This is the same as the drawable
resource directory, except resources in the mipmap
directory will not get stripped out when creating density-specific APKs.In certain cases, the Launcher app may use a higher resolution asset (than would normally be computed for the device) to display large app shortcuts. If drawables for densities other than the device's resolution have been stripped out, then the app shortcut could appear blurry.
To fix this, move your launcher icons from `drawable-`dpi to `mipmap-`dpi and change references from @drawable/ and R.drawable to @mipmap/ and R.mipmap.
In Android Studio this lint warning has a quickfix to perform this automatically.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MipmapIcons" as explained in the Suppressing Warnings and Errors section.
MissingApplicationIcon
Disabled By: Project lint.xml file
You should set an icon for the application as whole because there is no default. This attribute must be set as a reference to a drawable resource containing the image (for example
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingApplicationIcon" as explained in the Suppressing Warnings and Errors section.
@drawable/icon
).Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingApplicationIcon" as explained in the Suppressing Warnings and Errors section.
MissingBackupPin
Disabled By: Project lint.xml file
It is highly recommended to declare a backup
To suppress this error, use the issue id "MissingBackupPin" as explained in the Suppressing Warnings and Errors section.
<pin>
element. Not having a second pin defined can cause connection failures when the particular site certificate is rotated and the app has not yet been updated.To suppress this error, use the issue id "MissingBackupPin" as explained in the Suppressing Warnings and Errors section.
MissingConstraints
Disabled By: Project lint.xml file
The layout editor allows you to place widgets anywhere on the canvas, and it records the current position with designtime attributes (such as
To suppress this error, use the issue id "MissingConstraints" as explained in the Suppressing Warnings and Errors section.
layout_editor_absoluteX
). These attributes are not applied at runtime, so if you push your layout on a device, the widgets may appear in a different location than shown in the editor. To fix this, make sure a widget has both horizontal and vertical constraints by dragging from the edge connections.To suppress this error, use the issue id "MissingConstraints" as explained in the Suppressing Warnings and Errors section.
MissingFirebaseInstanceTokenRefresh
Disabled By: Project lint.xml file
Apps that check the Firebase Instance ID should usually implement the FirebaseInstanceIdService#onTokenRefresh() callback in order to observe changes.
To suppress this error, use the issue id "MissingFirebaseInstanceTokenRefresh" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "MissingFirebaseInstanceTokenRefresh" as explained in the Suppressing Warnings and Errors section.
MissingId
Disabled By: Project lint.xml file
If you do not specify an android:id or an android:tag attribute on a <fragment> element, then if the activity is restarted (for example for an orientation rotation) you may lose state. From the fragment documentation:
"Each fragment requires a unique identifier that the system can use to restore the fragment if the activity is restarted (and which you can use to capture the fragment to perform transactions, such as remove it).
* Supply the android:id attribute with a unique ID.
* Supply the android:tag attribute with a unique string.
If you provide neither of the previous two, the system uses the ID of the container view.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingId" as explained in the Suppressing Warnings and Errors section.
"Each fragment requires a unique identifier that the system can use to restore the fragment if the activity is restarted (and which you can use to capture the fragment to perform transactions, such as remove it).
* Supply the android:id attribute with a unique ID.
* Supply the android:tag attribute with a unique string.
If you provide neither of the previous two, the system uses the ID of the container view.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingId" as explained in the Suppressing Warnings and Errors section.
MissingIntentFilterForMediaSearch
Disabled By: Project lint.xml file
To support voice searches on Android Auto, you should also register an
To do this, add
to your
To suppress this error, use the issue id "MissingIntentFilterForMediaSearch" as explained in the Suppressing Warnings and Errors section.
intent-filter
for the action android.media.action.MEDIA_PLAY_FROM_SEARCH
.To do this, add
<intent-filter>
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
</intent-filter>
to your
<activity>
or <service>
.To suppress this error, use the issue id "MissingIntentFilterForMediaSearch" as explained in the Suppressing Warnings and Errors section.
MissingLeanbackLauncher
Disabled By: Project lint.xml file
An application intended to run on TV devices must declare a launcher activity for TV in its manifest using a
To suppress this error, use the issue id "MissingLeanbackLauncher" as explained in the Suppressing Warnings and Errors section.
android.intent.category.LEANBACK_LAUNCHER
intent filter.To suppress this error, use the issue id "MissingLeanbackLauncher" as explained in the Suppressing Warnings and Errors section.
MissingLeanbackSupport
Disabled By: Project lint.xml file
The manifest should declare the use of the Leanback user interface required by Android TV.
To fix this, add
to your manifest.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingLeanbackSupport" as explained in the Suppressing Warnings and Errors section.
To fix this, add
<uses-feature android:name="android.software.leanback" android:required="false" />
to your manifest.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingLeanbackSupport" as explained in the Suppressing Warnings and Errors section.
MissingMediaBrowserServiceIntentFilter
Disabled By: Project lint.xml file
An Automotive Media App requires an exported service that extends
To do this, add
to the service that extends
To suppress this error, use the issue id "MissingMediaBrowserServiceIntentFilter" as explained in the Suppressing Warnings and Errors section.
android.service.media.MediaBrowserService
with an intent-filter
for the action android.media.browse.MediaBrowserService
to be able to browse and play media.To do this, add
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
to the service that extends
android.service.media.MediaBrowserService
To suppress this error, use the issue id "MissingMediaBrowserServiceIntentFilter" as explained in the Suppressing Warnings and Errors section.
MissingOnPlayFromSearch
Disabled By: Project lint.xml file
To support voice searches on Android Auto, in addition to adding an
To suppress this error, use the issue id "MissingOnPlayFromSearch" as explained in the Suppressing Warnings and Errors section.
intent-filter
for the action onPlayFromSearch
, you also need to override and implement onPlayFromSearch(String query, Bundle bundle)
To suppress this error, use the issue id "MissingOnPlayFromSearch" as explained in the Suppressing Warnings and Errors section.
MissingPermission
Disabled By: Project lint.xml file
This check scans through your code and libraries and looks at the APIs being used, and checks this against the set of permissions required to access those APIs. If the code using those APIs is called at runtime, then the program will crash.
Furthermore, for permissions that are revocable (with targetSdkVersion 23), client code must also be prepared to handle the calls throwing an exception if the user rejects the request for permission at runtime.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingPermission" as explained in the Suppressing Warnings and Errors section.
Furthermore, for permissions that are revocable (with targetSdkVersion 23), client code must also be prepared to handle the calls throwing an exception if the user rejects the request for permission at runtime.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingPermission" as explained in the Suppressing Warnings and Errors section.
MissingPrefix
Disabled By: Project lint.xml file
Most Android views have attributes in the Android namespace. When referencing these attributes you must include the namespace prefix, or your attribute will be interpreted by
Similarly, in manifest files, nearly all attributes should be in the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingPrefix" as explained in the Suppressing Warnings and Errors section.
aapt
as just a custom attribute.Similarly, in manifest files, nearly all attributes should be in the
android:
namespace.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingPrefix" as explained in the Suppressing Warnings and Errors section.
MissingQuantity
Disabled By: Project lint.xml file
Different languages have different rules for grammatical agreement with quantity. In English, for example, the quantity 1 is a special case. We write "1 book", but for any other quantity we'd write "n books". This distinction between singular and plural is very common, but other languages make finer distinctions.
This lint check looks at each translation of a
For example, an English translation must provide a string for
To suppress this error, use the issue id "MissingQuantity" as explained in the Suppressing Warnings and Errors section.
This lint check looks at each translation of a
<plural>
and makes sure that all the quantity strings considered by the given language are provided by this translation.For example, an English translation must provide a string for
quantity="one"
. Similarly, a Czech translation must provide a string for quantity="few"
.To suppress this error, use the issue id "MissingQuantity" as explained in the Suppressing Warnings and Errors section.
MissingRegistered
Disabled By: Default
If a class is referenced in the manifest or in a layout file, it must also exist in the project (or in one of the libraries included by the project. This check helps uncover typos in registration names, or attempts to rename or move classes without updating the manifest file properly.
To suppress this error, use the issue id "MissingRegistered" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "MissingRegistered" as explained in the Suppressing Warnings and Errors section.
MissingSuperCall
Disabled By: Project lint.xml file
Some methods, such as
To suppress this error, use the issue id "MissingSuperCall" as explained in the Suppressing Warnings and Errors section.
View#onDetachedFromWindow
, require that you also call the super implementation as part of your method.To suppress this error, use the issue id "MissingSuperCall" as explained in the Suppressing Warnings and Errors section.
MissingTranslation
Disabled By: Project lint.xml file
If an application has more than one locale, then all the strings declared in one language should also be translated in all other languages.
If the string should not be translated, you can add the attribute
You can tell lint (and other tools) which language is the default language in your
To suppress this error, use the issue id "MissingTranslation" as explained in the Suppressing Warnings and Errors section.
If the string should not be translated, you can add the attribute
translatable="false"
on the <string>
element, or you can define all your non-translatable strings in a resource file called donottranslate.xml
. Or, you can ignore the issue with a tools:ignore="MissingTranslation"
attribute.You can tell lint (and other tools) which language is the default language in your
res/values/
folder by specifying tools:locale="languageCode"
for the root <resources>
element in your resource file. (The tools
prefix refers to the namespace declaration http://schemas.android.com/tools
.)To suppress this error, use the issue id "MissingTranslation" as explained in the Suppressing Warnings and Errors section.
MissingTvBanner
Disabled By: Project lint.xml file
A TV application must provide a home screen banner for each localization if it includes a Leanback launcher intent filter. The banner is the app launch point that appears on the home screen in the apps and games rows.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingTvBanner" 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 "MissingTvBanner" as explained in the Suppressing Warnings and Errors section.
MissingVersion
Disabled By: Project lint.xml file
You should define the version information for your application.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingVersion" as explained in the Suppressing Warnings and Errors section.
android:versionCode
: An integer value that represents the version of the application code, relative to other versions.android:versionName
: A string value that represents the release version of the application code, as it should be shown to users.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "MissingVersion" as explained in the Suppressing Warnings and Errors section.
NegativeMargin
Disabled By: Default
Margin values should be positive. Negative values are generally a sign that you are making assumptions about views surrounding the current one, or may be tempted to turn off child clipping to allow a view to escape its parent. Turning off child clipping to do this not only leads to poor graphical performance, it also results in wrong touch event handling since touch events are based strictly on a chain of parent-rect hit tests. Finally, making assumptions about the size of strings can lead to localization problems.
To suppress this error, use the issue id "NegativeMargin" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "NegativeMargin" as explained in the Suppressing Warnings and Errors section.
NestedScrolling
Disabled By: Project lint.xml file
A scrolling widget such as a
To suppress this error, use the issue id "NestedScrolling" as explained in the Suppressing Warnings and Errors section.
ScrollView
should not contain any nested scrolling widgets since this has various usability issuesTo suppress this error, use the issue id "NestedScrolling" as explained in the Suppressing Warnings and Errors section.
NestedWeights
Disabled By: Project lint.xml file
Layout weights require a widget to be measured twice. When a LinearLayout with non-zero weights is nested inside another LinearLayout with non-zero weights, then the number of measurements increase exponentially.
To suppress this error, use the issue id "NestedWeights" as explained in the Suppressing Warnings and Errors section.
To suppress this error, use the issue id "NestedWeights" as explained in the Suppressing Warnings and Errors section.
NewApi
Disabled By: Project lint.xml file
This check scans through all the Android API calls in the application and warns about any calls that are not available on all versions targeted by this application (according to its minimum SDK attribute in the manifest).
If you really want to use this API and don't need to support older devices just set the
If your code is deliberately accessing newer APIs, and you have ensured (e.g. with conditional execution) that this code will only ever be called on a supported platform, then you can annotate your class or method with the
If you are deliberately setting
Similarly, you can use tools:targetApi="11" in an XML file to indicate that the element will only be inflated in an adequate context.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "NewApi" as explained in the Suppressing Warnings and Errors section.
If you really want to use this API and don't need to support older devices just set the
minSdkVersion
in your build.gradle
or AndroidManifest.xml
files.If your code is deliberately accessing newer APIs, and you have ensured (e.g. with conditional execution) that this code will only ever be called on a supported platform, then you can annotate your class or method with the
@TargetApi
annotation specifying the local minimum SDK to apply, such as @TargetApi(11)
, such that this check considers 11 rather than your manifest file's minimum SDK as the required API level.If you are deliberately setting
android:
attributes in style definitions, make sure you place this in a values-v
NN folder in order to avoid running into runtime conflicts on certain devices where manufacturers have added custom attributes whose ids conflict with the new ones on later platforms.Similarly, you can use tools:targetApi="11" in an XML file to indicate that the element will only be inflated in an adequate context.
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "NewApi" as explained in the Suppressing Warnings and Errors section.
NewerVersionAvailable
Disabled By: Default
This detector checks with a central repository to see if there are newer versions available for the dependencies used by this project. This is similar to the
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "NewerVersionAvailable" as explained in the Suppressing Warnings and Errors section.
GradleDependency
check, which checks for newer versions available in the Android SDK tools and libraries, but this works with any MavenCentral dependency, and connects to the library every time, which makes it more flexible but also much slower.Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "NewerVersionAvailable" as explained in the Suppressing Warnings and Errors section.
NoHardKeywords
Disabled By: Default
Do not use Kotlin’s hard keywords as the name of methods or fields.
These require the use of backticks to escape when calling from Kotlin.
Soft keywords, modifier keywords, and special identifiers are allowed.
For example, Mockito’s
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.
These require the use of backticks to escape when calling from Kotlin.
Soft keywords, modifier keywords, and special identifiers are allowed.
For example, Mockito’s
when