当前位置: 代码迷 >> Android >> Android Lint 稽查项说明
  详细解决方案

Android Lint 稽查项说明

热度:144   发布时间:2016-04-27 22:59:01.0
Android Lint 检查项说明

?

查看检查项:

$ lint --show

?执行结果:

Correctness===========AdapterViewChildren-------------------Summary: AdapterViews cannot have children in XMLPriority: 10 / 10Severity: WarningCategory: CorrectnessAdapterViews such as ListViews must be configured with data from Java code,such as a ListAdapter.More information: http://developer.android.com/reference/android/widget/AdapterView.htmlOnClick-------Summary: onClick method does not existPriority: 10 / 10Severity: ErrorCategory: CorrectnessThe onClick attribute value should be the name of a method in this View'scontext to invoke when the view is clicked. This name must correspond to apublic method that takes exactly one parameter of type View.Must be a string value, using '\;' to escape characters such as '\n' or'\uxxxx' for a unicode character.StopShip--------Summary: Code contains STOPSHIP markerPriority: 10 / 10Severity: WarningCategory: CorrectnessNOTE: This issue is disabled by default!You can enable it by adding --enable StopShipUsing the comment // STOPSHIP can be used to flag code that is incomplete butchecked in. This comment marker can be used to indicate that the code shouldnot be shipped until the issue is addressed, and lint will look for these.MissingPermission-----------------Summary: Missing PermissionsPriority: 9 / 10Severity: ErrorCategory: CorrectnessThis check scans through your code and libraries and looks at the APIs beingused, and checks this against the set of permissions required to access thoseAPIs. If the code using those APIs is called at runtime, then the program willcrash.Furthermore, for permissions that are revocable (with targetSdkVersion 23),client code must also be prepared to handle the calls throwing an exception ifthe user rejects the request for permission at runtime.MissingSuperCall----------------Summary: Missing Super CallPriority: 9 / 10Severity: ErrorCategory: CorrectnessSome methods, such as View#onDetachedFromWindow, require that you also callthe super implementation as part of your method.ResAuto-------Summary: Hardcoded Package in NamespacePriority: 9 / 10Severity: FatalCategory: CorrectnessIn Gradle projects, the actual package used in the final APK can vary; forexample,you can add a .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-autowhich will cause the tools to figure out the right namespace for the resourceregardless of the actual package used during the build.SuspiciousImport----------------Summary: 'import android.R' statementPriority: 9 / 10Severity: WarningCategory: CorrectnessImporting android.R is usually not intentional; it sometimes happens when youuse an IDE and ask it to automatically add imports at a time when yourproject's R class it not present.Once the import is there you might get a lot of "confusing" error messagesbecause of course the fields available on android.R are not the ones you'dexpect from just looking at your own R class.UsesMinSdkAttributes--------------------Summary: Minimum SDK and target SDK attributes not definedPriority: 9 / 10Severity: WarningCategory: CorrectnessThe manifest should contain a <uses-sdk> element which defines the minimum APILevel required for the application to run, as well as the target version (thehighest API level you have tested the version for.)More information: http://developer.android.com/guide/topics/manifest/uses-sdk-element.htmlWrongViewCast-------------Summary: Mismatched view typePriority: 9 / 10Severity: FatalCategory: CorrectnessKeeps track of the view types associated with ids and if it finds a usage ofthe id in the Java code it ensures that it is treated as the same type.AaptCrash---------Summary: Potential AAPT crashPriority: 8 / 10Severity: FatalCategory: CorrectnessDefining a style which sets android:id to a dynamically generated id can causemany versions of aapt, the resource packaging tool, to crash. To work aroundthis, declare the id explicitly with <item type="id" name="..." /> instead.More information: https://code.google.com/p/android/issues/detail?id=20479AndroidGradlePluginVersion--------------------------Summary: Incompatible Android Gradle PluginPriority: 8 / 10Severity: ErrorCategory: CorrectnessNot all versions of the Android Gradle plugin are compatible with all versionsof the SDK. If you update your tools, or if you are trying to open a projectthat was built with an old version of the tools, you may need to update yourplugin version number.GradleCompatible----------------Summary: Incompatible Gradle VersionsPriority: 8 / 10Severity: ErrorCategory: CorrectnessThere are some combinations of libraries, or tools and libraries, that areincompatible, or can lead to bugs. One such incompatibility is compiling witha version of the Android support libraries that is not the latest version (orin particular, a version lower than your targetSdkVersion.)IllegalResourceRef------------------Summary: Name and version must be integer or string, not resourcePriority: 8 / 10Severity: WarningCategory: CorrectnessFor the versionCode attribute, you have to specify an actual integer literal;you cannot use an indirection with a @dimen/name resource. Similarly, theversionName attribute should be an actual string, not a string resource url.MissingRegistered-----------------Summary: Missing registered classPriority: 8 / 10Severity: ErrorCategory: CorrectnessIf a class is referenced in the manifest, it must also exist in the project(or in one of the libraries included by the project. This check helps uncovertypos in registration names, or attempts to rename or move classes withoutupdating the manifest file properly.More information: http://developer.android.com/guide/topics/manifest/manifest-intro.htmlMockLocation------------Summary: Using mock location provider in productionPriority: 8 / 10Severity: FatalCategory: CorrectnessUsing a mock location provider (by requiring the permissionandroid.permission.ACCESS_MOCK_LOCATION) should only be done in debug builds(or from tests). In Gradle projects, that means you should only request thispermission in a test or debug source set specific manifest file.To fix this, create a new manifest file in the debug folder and move the<uses-permission> element there. A typical path to a debug manifest overridefile in a Gradle project is src/debug/AndroidManifest.xml.NamespaceTypo-------------Summary: Misspelled namespace declarationPriority: 8 / 10Severity: FatalCategory: CorrectnessAccidental misspellings in namespace declarations can lead to some veryobscure error messages. This check looks for potential misspellings to helptrack these down.Proguard--------Summary: Using obsolete ProGuard configurationPriority: 8 / 10Severity: FatalCategory: CorrectnessUsing -keepclasseswithmembernames in a proguard config file is not correct; itcan cause some symbols to be renamed which should not be.Earlier versions of ADT used to create proguard.cfg files with the wrongformat. Instead of -keepclasseswithmembernames use -keepclasseswithmembers,since the old flags also implies "allow shrinking" which means symbols onlyreferred to from XML and not Java (such as possibly CustomViews) can getdeleted.More information: http://http://code.google.com/p/android/issues/detail?id=16384ReferenceType-------------Summary: Incorrect reference typesPriority: 8 / 10Severity: FatalCategory: CorrectnessWhen you generate a resource alias, the resource you are pointing to must beof the same type as the aliasResourceCycle-------------Summary: Cycle in resource definitionsPriority: 8 / 10Severity: FatalCategory: CorrectnessThere should be no cycles in resource definitions as this can lead to runtimeexceptions.ResourceName------------Summary: Resource with Wrong PrefixPriority: 8 / 10Severity: FatalCategory: CorrectnessIn Gradle projects you can specify a resource prefix that all resources in theproject must conform to. This makes it easier to ensure that you don'taccidentally combine resources from different libraries, since they all end upin the same shared app namespace.ScrollViewCount---------------Summary: ScrollViews can have only one childPriority: 8 / 10Severity: WarningCategory: CorrectnessScrollViews can only have one child widget. If you want more children, wrapthem in a container layout.StringShouldBeInt-----------------Summary: String should be intPriority: 8 / 10Severity: ErrorCategory: CorrectnessThe properties compileSdkVersion, minSdkVersion and targetSdkVersion areusually numbers, but can be strings when you are using an add-on (in the caseof compileSdkVersion) or a preview platform (for the other two properties).However, you can not use a number as a string (e.g. "19" instead of 19); thatwill result in a platform not found error message at build/sync time.UnknownId---------Summary: Reference to an unknown idPriority: 8 / 10Severity: FatalCategory: CorrectnessThe @+id/ syntax refers to an existing id, or creates a new one if it has notalready been defined elsewhere. However, this means that if you have a typo inyour reference, or if the referred view no longer exists, you do not get awarning since the id will be created on demand. This check catches errorswhere you have renamed an id without updating all of the references to it.WrongFolder-----------Summary: Resource file in the wrong res folderPriority: 8 / 10Severity: FatalCategory: CorrectnessResource files are sometimes placed in the wrong folder, and it can lead tosubtle bugs that are hard to understand. This check looks for problems in thisarea, such as attempting to place a layout "alias" file in a layout/ folderrather than the values/ folder where it belongs.CommitTransaction-----------------Summary: Missing commit() callsPriority: 7 / 10Severity: WarningCategory: CorrectnessAfter creating a FragmentTransaction, you typically need to commit it as wellDalvikOverride--------------Summary: Method considered overridden by DalvikPriority: 7 / 10Severity: ErrorCategory: CorrectnessThe Android virtual machine will treat a package private method in one classas overriding a package private method in its super class, even if they are inseparate packages. This may be surprising, but for compatibility reasons thebehavior has not been changed (yet).If you really did intend for this method to override the other, make themethod protected instead.If you did not intend the override, consider making the method private, orchanging its name or signature.DeviceAdmin-----------Summary: Malformed Device AdminPriority: 7 / 10Severity: WarningCategory: CorrectnessIf you register a broadcast receiver which acts as a device admin, you mustalso register an <intent-filter> for the actionandroid.app.action.DEVICE_ADMIN_ENABLED, without any <data>, such that thedevice 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>.DuplicateIds------------Summary: Duplicate ids within a single layoutPriority: 7 / 10Severity: FatalCategory: CorrectnessWithin a layout, id's should be unique since otherwise findViewById() canreturn an unexpected view.InconsistentArrays------------------Summary: Inconsistencies in array element countsPriority: 7 / 10Severity: WarningCategory: CorrectnessWhen an array is translated in a different locale, it should normally have thesame number of elements as the original array. When adding or removingelements to an array, it is easy to forget to update all the locales, and thislint warning finds inconsistencies like these.Note however that there may be cases where you really want to declare adifferent number of array items in each configuration (for example where thearray represents available options, and those options differ for differentlayout orientations and so on), so use your own judgement to decide if this isreally an error.You can suppress this error type if it finds false errors in your project.NestedScrolling---------------Summary: Nested scrolling widgetsPriority: 7 / 10Severity: WarningCategory: CorrectnessA scrolling widget such as a ScrollView should not contain any nestedscrolling widgets since this has various usability issuesResourceAsColor---------------Summary: Should pass resolved color instead of resource idPriority: 7 / 10Severity: ErrorCategory: CorrectnessMethods that take a color in the form of an integer should be passed an RGBtriple, not the actual color resource id. You must callgetResources().getColor(resource) to resolve the actual color value first.ResourceType------------Summary: Wrong Resource TypePriority: 7 / 10Severity: FatalCategory: CorrectnessEnsures that resource id's passed to APIs are of the right type; for example,calling Resources.getColor(R.string.name) is wrong.ScrollViewSize--------------Summary: ScrollView size validationPriority: 7 / 10Severity: WarningCategory: CorrectnessScrollView children must set their layout_width or layout_height attributes towrap_content rather than fill_parent or match_parent in the scrollingdimensionTextViewEdits-------------Summary: TextView should probably be an EditText insteadPriority: 7 / 10Severity: WarningCategory: CorrectnessUsing a <TextView> to input text is generally an error, you should be using<EditText> instead.  EditText is a subclass of TextView, and some of theediting support is provided by TextView, so it's possible to set someinput-related properties on a TextView. However, using a TextView along withinput attributes is usually a cut & paste error. To input text you should beusing <EditText>.This check also checks subclasses of TextView, such as Button and CheckBox,since these have the same issue: they should not be used with editableattributes.WebViewLayout-------------Summary: WebViews in wrap_content parentsPriority: 7 / 10Severity: ErrorCategory: CorrectnessThe WebView implementation has certain performance optimizations which willnot work correctly if the parent view is using wrap_content rather thanmatch_parent. This can lead to subtle UI bugs.AppCompatMethod---------------Summary: Using Wrong AppCompat MethodPriority: 6 / 10Severity: WarningCategory: CorrectnessWhen using the appcompat library, there are some methods you should be callinginstead of the normal ones; for example, getSupportActionBar() instead ofgetActionBar(). This lint check looks for calls to the wrong method.More information: http://developer.android.com/tools/support-library/index.htmlAssert------Summary: AssertionsPriority: 6 / 10Severity: WarningCategory: CorrectnessAssertions are not checked at runtime. There are ways to request that they beused by Dalvik (adb shell setprop debug.assert 1), but the property is ignoredin many places and can not be relied upon. Instead, perform conditionalchecking inside if (BuildConfig.DEBUG) { } blocks. That constant is a staticfinal boolean which is true in debug builds and false in release builds, andthe Java compiler completely removes all code inside the if-body from theapp.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 ornon-nullness; these are typically more intended for tools usage than runtimechecks.)More information: https://code.google.com/p/android/issues/detail?id=65183CheckResult-----------Summary: Ignoring resultsPriority: 6 / 10Severity: WarningCategory: CorrectnessSome methods have no side effects, an calling them without doing somethingwithout the result is suspicious. CommitPrefEdits---------------Summary: Missing commit() on SharedPreference editorPriority: 6 / 10Severity: WarningCategory: CorrectnessAfter calling edit() on a SharedPreference, you must call commit() or apply()on the editor to save the results.CustomViewStyleable-------------------Summary: Mismatched Styleable/Custom View NamePriority: 6 / 10Severity: WarningCategory: CorrectnessThe convention for custom views is to use a declare-styleable whose namematches the custom view class name. The IDE relies on this convention suchthat for example code completion can be offered for attributes in a customview in layout XML resource files.(Similarly, layout parameter classes should use the suffix _Layout.)CutPasteId----------Summary: Likely cut & paste mistakesPriority: 6 / 10Severity: WarningCategory: CorrectnessThis lint check looks for cases where you have cut & pasted calls tofindViewById but have forgotten to update the R.id field. It's possible thatyour code is simply (redundantly) looking up the field repeatedly, but lintcannot distinguish that from a case where you for example want to initializefields prev and next and you cut & pasted findViewById(R.id.prev) and forgotto update the second initialization to R.id.next.DefaultLocale-------------Summary: Implied default locale in case conversionPriority: 6 / 10Severity: WarningCategory: CorrectnessCalling String#toLowerCase() or #toUpperCase() without specifying an explicitlocale is a common source of bugs. The reason for that is that those methodswill use the current locale on the user's device, and even though the codeappears to work correctly when you are developing the app, it will fail insome locales. For example, in the Turkish locale, the uppercase replacementfor i is not I.If you want the methods to just perform ASCII replacement, for example toconvert an enum name, call String#toUpperCase(Locale.US) instead. If youreally want to use the current locale, callString#toUpperCase(Locale.getDefault()) instead.More information: http://developer.android.com/reference/java/util/Locale.html#default_localeDuplicateDefinition-------------------Summary: Duplicate definitions of resourcesPriority: 6 / 10Severity: ErrorCategory: CorrectnessYou can define a resource multiple times in different resource folders; that'show string translations are done, for example. However, defining the sameresource more than once in the same resource folder is likely an error, forexample attempting to add a new resource without realizing that the name isalready used, and so on.DuplicateIncludedIds--------------------Summary: Duplicate ids across layouts combined with include tagsPriority: 6 / 10Severity: WarningCategory: CorrectnessIt's okay for two independent layouts to use the same ids. However, if layoutsare combined with include tags, then the id's need to be unique within anychain of included layouts, or Activity#findViewById() can return an unexpectedview.GradleDeprecated----------------Summary: Deprecated Gradle ConstructPriority: 6 / 10Severity: WarningCategory: CorrectnessThis detector looks for deprecated Gradle constructs which currently work butwill likely stop working in a future update.GradleGetter------------Summary: Gradle Implicit Getter CallPriority: 6 / 10Severity: ErrorCategory: CorrectnessGradle will let you replace specific constants in your build scripts withmethod calls, so you can for example dynamically compute a version stringbased on your current version control revision number, rather than hardcodinga number.When computing a version name, it's tempting to for example call the method todo that getVersionName. However, when you put that method call inside thedefaultConfig block, you will actually be calling the Groovy getter for theversionName property instead. Therefore, you need to name your methodsomething which does not conflict with the existing implicit getters. Considerusing compute as a prefix instead of get.InconsistentLayout------------------Summary: Inconsistent LayoutsPriority: 6 / 10Severity: WarningCategory: CorrectnessThis check ensures that a layout resource which is defined in multipleresource folders, specifies the same set of widgets.This finds cases where you have accidentally forgotten to add a widget to allvariations of the layout, which could result in a runtime crash for someresource configurations when a findViewById() fails.There are cases where this is intentional. For example, you may have adedicated large tablet layout which adds some extra widgets that are notpresent in the phone version of the layout. As long as the code accessing thelayout 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 thewhole layoutInlinedApi----------Summary: Using inlined constants on older versionsPriority: 6 / 10Severity: WarningCategory: CorrectnessThis check scans through all the Android API field references in theapplication and flags certain constants, such as static final integers andStrings, which were introduced in later versions. These will actually becopied into the class files rather than being referenced, which means that thevalue is available even when running on older devices. In some cases that'sfine, and in other cases it can result in a runtime crash or incorrectbehavior. It depends on the context, so consider the code carefully and devicewhether it's safe and can be suppressed or whether the code needs tbeguarded.If you really want to use this API and don't need to support older devicesjust 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 asupported 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 manifestfile's minimum SDK as the required API level.Instantiatable--------------Summary: Registered class is not instantiatablePriority: 6 / 10Severity: FatalCategory: CorrectnessActivities, services, broadcast receivers etc. registered in the manifest file(or for custom views, in a layout file) must be "instantiatable" by thesystem, which means that the class must be public, it must have an emptypublic constructor, and if it's an inner class, it must be a static innerclass.InvalidId---------Summary: Invalid ID declarationPriority: 6 / 10Severity: FatalCategory: CorrectnessAn id definition must be of the form @+id/yourname. The tools have notrejected strings of the form @+foo/bar in the past, but that was an error, andcould lead to tricky errors because of the way the id integers are assigned.If you really want to have different "scopes" for your id's, use prefixesinstead, such as login_button1 and login_button2.InvalidPackage--------------Summary: Package not included in AndroidPriority: 6 / 10Severity: ErrorCategory: CorrectnessThis check scans through libraries looking for calls to APIs that are notincluded in Android.When you create Android projects, the classpath is set up such that you canonly 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 thatthose .jar files were built with an Android specific classpath, and inparticular, they could be accessing unsupported APIs such as java.applet.This check scans through library jars and looks for references to API packagesthat are not included in Android and flags these. This is only an error ifyour code calls one of the library classes which wind up referencing theunsupported package.InvalidResourceFolder---------------------Summary: Invalid Resource FolderPriority: 6 / 10Severity: ErrorCategory: CorrectnessThis lint check looks for a folder name that is not a valid resource foldername; these will be ignored and not packaged by the Android Gradle buildplugin.Note that the order of resources is very important; for example, you can'tspecify a language before a network code.Similarly, note that to use 3 letter region codes, you have to use a specialBCP 47 syntax: the prefix b+ followed by the BCP 47 language tag but with + asthe individual separators instead of -. Therefore, for the BCP 47 language tagnl-ABW you have to use b+nl+ABW.More information: http://developer.android.com/guide/topics/resources/providing-resources.htmlhttps://tools.ietf.org/html/bcp47LibraryCustomView-----------------Summary: Custom views in libraries should use res-auto-namespacePriority: 6 / 10Severity: FatalCategory: CorrectnessWhen using a custom view with custom attributes in a library project, thelayout must use the special namespace http://schemas.android.com/apk/res-autoinstead of a URI which includes the library project's own package. This willbe used to automatically adjust the namespace of the attributes when thelibrary resources are merged into the application project.LocaleFolder------------Summary: Wrong locale namePriority: 6 / 10Severity: WarningCategory: CorrectnessFrom the 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 Localeobject, not just for instances returned by the various lookup methods.Because of this, if you add your localized resources in for example values-hethey 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 thedeprecated language code instead.More information: http://developer.android.com/reference/java/util/Locale.htmlMissingPrefix-------------Summary: Missing Android XML namespacePriority: 6 / 10Severity: ErrorCategory: CorrectnessMost Android views have attributes in the Android namespace. When referencingthese attributes you must include the namespace prefix, or your attribute willbe interpreted by aapt as just a custom attribute.Similarly, in manifest files, nearly all attributes should be in the android:namespace.MultipleUsesSdk---------------Summary: Multiple <uses-sdk> elements in the manifestPriority: 6 / 10Severity: FatalCategory: CorrectnessThe <uses-sdk> element should appear just once; the tools will not merge thecontents of all the elements so if you split up the attributes across multipleelements, only one of them will take effect. To fix this, just merge all theattributes from the various elements into a single <uses-sdk> element.More information: http://developer.android.com/guide/topics/manifest/uses-sdk-element.htmlNewApi------Summary: Calling new methods on older versionsPriority: 6 / 10Severity: ErrorCategory: CorrectnessThis check scans through all the Android API calls in the application andwarns about any calls that are not available on all versions targeted by thisapplication (according to its minimum SDK attribute in the manifest).If you really want to use this API and don't need to support older devicesjust 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 asupported 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 manifestfile's minimum SDK as the required API level.If you are deliberately setting android: attributes in style definitions, makesure you place this in a values-vNN folder in order to avoid running intoruntime conflicts on certain devices where manufacturers have added customattributes whose ids conflict with the new ones on later platforms.Similarly, you can use tools:targetApi="11" in an XML file to indicate thatthe element will only be inflated in an adequate context.NotSibling----------Summary: RelativeLayout Invalid ConstraintsPriority: 6 / 10Severity: FatalCategory: CorrectnessLayout constraints in a given RelativeLayout should reference other viewswithin the same relative layout (but not itself!)OldTargetApi------------Summary: Target SDK attribute is not targeting latest versionPriority: 6 / 10Severity: WarningCategory: CorrectnessWhen your application runs on a version of Android that is more recent thanyour targetSdkVersion specifies that it has been tested with, variouscompatibility modes kick in. This ensures that your application continues towork, but it may look out of place. For example, if the targetSdkVersion isless than 14, your app may get an option button in the UI.To fix this issue, set the targetSdkVersion to the highest available value.Then test your app to make sure everything works correctly. You may want toconsult the compatibility notes to see what changes apply to each version youare adding support for:http://developer.android.com/reference/android/os/Build.VERSION_CODES.htmlMore information: http://developer.android.com/reference/android/os/Build.VERSION_CODES.htmlOverride--------Summary: Method conflicts with new inherited methodPriority: 6 / 10Severity: ErrorCategory: CorrectnessSuppose you are building against Android API 8, and you've subclassedActivity. In your subclass you add a new method called isDestroyed(). At somelater point, a method of the same name and signature is added to Android. Yourmethod will now override the Android method, and possibly break its contract.Your method is not calling super.isDestroyed(), since your compilation targetdoesn't know about the method.The above scenario is what this lint detector looks for. The above example isreal, since isDestroyed() was added in API 17, but it will be true for anymethod you have added to a subclass of an Android class where your buildtarget is lower than the version the method was introduced in.To fix this, either rename your method, or if you are really trying to augmentthe builtin method if available, switch to a higher build target where you candeliberately add @Override on your overriding method, and call super ifappropriate etc.OverrideAbstract----------------Summary: Not overriding abstract methods on older platformsPriority: 6 / 10Severity: FatalCategory: CorrectnessTo improve the usability of some APIs, some methods that used to be abstracthave been made concrete by adding default implementations. This means thatwhen compiling with new versions of the SDK, your code does not have tooverride these methods.However, if your code is also targeting older versions of the platform wherethese methods were still abstract, the code will crash. You must override allmethods that used to be abstract in any versions targeted by yourapplication's minSdkVersion.PropertyEscape--------------Summary: Incorrect property escapesPriority: 6 / 10Severity: ErrorCategory: CorrectnessAll backslashes and colons in .property files must be escaped with a backslash(\). This means that when writing a Windows path, you must escape the fileseparators, so the path \My\Files should be written as key=\\My\\Files.Range-----Summary: Outside RangePriority: 6 / 10Severity: ErrorCategory: CorrectnessSome parameters are required to in a particular numerical range; this checkmakes sure that arguments passed fall within the range. For arrays, Stringsand collections this refers to the size or length.Registered----------Summary: Class is not registered in the manifestPriority: 6 / 10Severity: WarningCategory: CorrectnessActivities, services and content providers should be registered in theAndroidManifest.xml file using <activity>, <service> and <provider> tags.If your activity is simply a parent class intended to be subclassed by other"real" activities, make it an abstract class.More information: http://developer.android.com/guide/topics/manifest/manifest-intro.htmlSdCardPath----------Summary: Hardcoded reference to /sdcardPriority: 6 / 10Severity: WarningCategory: CorrectnessYour code should not reference the /sdcard path directly; instead useEnvironment.getExternalStorageDirectory().getPath().Similarly, do not reference the /data/data/ path directly; it can vary inmulti-user scenarios. Instead, use Context.getFilesDir().getPath().More information: http://developer.android.com/guide/topics/data/data-storage.html#filesExternalServiceCast-----------Summary: Wrong system service castsPriority: 6 / 10Severity: FatalCategory: CorrectnessWhen you call Context#getSystemService(), the result is typically cast to aspecific interface. This lint check ensures that the cast is compatible withthe expected type of the return value.ShortAlarm----------Summary: Short or Frequent AlarmPriority: 6 / 10Severity: WarningCategory: CorrectnessFrequent alarms are bad for battery life. As of API 22, the AlarmManager willoverride near-future and high-frequency alarm requests, delaying the alarm atleast 5 seconds into the future and ensuring that the repeat interval is atleast 60 seconds.If you really need to do work sooner than 5 seconds, post a delayed message orrunnable to a Handler.ShowToast---------Summary: Toast created but not shownPriority: 6 / 10Severity: WarningCategory: CorrectnessToast.makeText() creates a Toast but does not show it. You must call show() onthe resulting object to actually make the Toast appear.SimpleDateFormat----------------Summary: Implied locale in date formatPriority: 6 / 10Severity: WarningCategory: CorrectnessAlmost all callers should use getDateInstance(), getDateTimeInstance(), orgetTimeInstance() to get a ready-made instance of SimpleDateFormat suitablefor the user's locale. The main reason you'd create an instance this classdirectly is because you need to format/parse a specific machine-readableformat, in which case you almost certainly want to explicitly ask for US toensure that you get ASCII digits (rather than, say, Arabic digits).Therefore, you should either use the form of the SimpleDateFormat constructorwhere you pass in an explicit locale, such as Locale.US, or use one of the getinstance methods, or suppress this error if really know what you are doing.More information: http://developer.android.com/reference/java/text/SimpleDateFormat.htmlSuspicious0dp-------------Summary: Suspicious 0dp dimensionPriority: 6 / 10Severity: ErrorCategory: CorrectnessUsing 0dp as the width in a horizontal LinearLayout with weights is a usefultrick to ensure that only the weights (and not the intrinsic sizes) are usedwhen sizing the children.However, if you use 0dp for the opposite dimension, the view will beinvisible. This can happen if you change the orientation of a layout withoutalso flipping the 0dp dimension in all the children.UniquePermission----------------Summary: Permission names are not uniquePriority: 6 / 10Severity: FatalCategory: CorrectnessThe unqualified names or your permissions must be unique. The reason for thisis that at build time, the aapt tool will generate a class named Manifestwhich contains a field for each of your permissions. These fields are namedusing your permission unqualified names (i.e. the name portion after the lastdot).If more than one permission maps to the same field name, that field willarbitrarily name just one of them.UnusedAttribute---------------Summary: Attribute unused on older versionsPriority: 6 / 10Severity: WarningCategory: CorrectnessThis check finds attributes set in XML files that were introduced in a versionnewer than the oldest version targeted by your application (with theminSdkVersion attribute).This is not an error; the application will simply ignore the attribute.However, if the attribute is important to the appearance of functionality ofyour application, you should consider finding an alternative way to achievethe same result with only available attributes, and then you can optionallycreate a copy of the layout in a layout-vNN folder which will be used on APINN or higher where you can take advantage of the newer attribute.Note: This check does not only apply to attributes. For example, some tags canbe unused too, such as the new <tag> element in layouts introduced in API 21.UseAlpha2---------Summary: Using 3-letter CodesPriority: 6 / 10Severity: WarningCategory: CorrectnessFor compatibility with earlier devices, you should only use 3-letter languageand region codes when there is no corresponding 2 letter code.More information: https://tools.ietf.org/html/bcp47ValidFragment-------------Summary: Fragment not instantiatablePriority: 6 / 10Severity: FatalCategory: CorrectnessFrom the Fragment documentation:Every fragment must have an empty constructor, so it can be instantiated whenrestoring its activity's state. It is strongly recommended that subclasses donot have other constructors with parameters, since these constructors will notbe called when the fragment is re-instantiated; instead, arguments can besupplied by the caller with setArguments(Bundle) and later retrieved by theFragment with getArguments().More information: http://developer.android.com/reference/android/app/Fragment.html#Fragment()WrongCall---------Summary: Using wrong draw/layout methodPriority: 6 / 10Severity: FatalCategory: CorrectnessCustom views typically need to call measure() on their children, notonMeasure. Ditto for onDraw, onLayout, etc.WrongManifestParent-------------------Summary: Wrong manifest parentPriority: 6 / 10Severity: FatalCategory: CorrectnessThe <uses-library> element should be defined as a direct child of the<application> tag, not the <manifest> tag or an <activity> tag. Similarly, a<uses-sdk> tag much be declared at the root level, and so on. This check looksfor incorrect declaration locations in the manifest, and complains if anelement is found in the wrong place.More information: http://developer.android.com/guide/topics/manifest/manifest-intro.htmlWrongRegion-----------Summary: Suspicious Language/Region CombinationPriority: 6 / 10Severity: WarningCategory: CorrectnessAndroid uses the letter codes ISO 639-1 for languages, and the letter codesISO 3166-1 for the region codes. In many cases, the language code and thecountry where the language is spoken is the same, but it is also often not thecase. For example, while 'se' refers to Sweden, where Swedish is spoken, thelanguage code for Swedish is not se (which refers to the Northern Samilanguage), the language code is sv. And similarly the region code for sv is ElSalvador.This lint check looks for suspicious language and region combinations, to helpcatch cases where you've accidentally used the wrong language or region code.Lint knows about the most common regions where a language is spoken, and if afolder combination is not one of these, it is flagged as suspicious.Note however that it may not be an error: you can theoretically have speakersof any language in any region and want to target that with your resources, sothis check is aimed at tracking down likely mistakes, not to enforce aspecific set of region and language combinations.WrongThread-----------Summary: Wrong ThreadPriority: 6 / 10Severity: ErrorCategory: CorrectnessEnsures that a method which expects to be called on a specific thread, isactually called from that thread. For example, calls on methods in widgetsshould always be made on the UI thread.More information: http://developer.android.com/guide/components/processes-and-threads.html#ThreadsDuplicateActivity-----------------Summary: Activity registered more than oncePriority: 5 / 10Severity: FatalCategory: CorrectnessAn activity should only be registered once in the manifest. If it isaccidentally registered more than once, then subtle errors can occur, sinceattribute declarations from the two elements are not merged, so you mayaccidentally remove previous declarations.DuplicateUsesFeature--------------------Summary: Feature declared more than oncePriority: 5 / 10Severity: WarningCategory: CorrectnessA given feature should only be declared once in the manifest.FullBackupContent-----------------Summary: Valid Full Backup Content FilePriority: 5 / 10Severity: FatalCategory: CorrectnessEnsures that a <full-backup-content> file, which is pointed to by aandroid:fullBackupContent attribute in the manifest file, is validMore information: http://android-developers.blogspot.com/2015/07/auto-backup-for-apps-made-simple.htmlIncludeLayoutParam------------------Summary: Ignored layout params on includePriority: 5 / 10Severity: ErrorCategory: CorrectnessLayout parameters specified on an <include> tag will only be used if you alsooverride layout_width and layout_height on the <include> tag; otherwise theywill be ignored.More information: http://stackoverflow.com/questions/2631614/does-android-xml-layouts-include-tag-really-workInflateParams-------------Summary: Layout Inflation without a ParentPriority: 5 / 10Severity: WarningCategory: CorrectnessWhen inflating a layout, avoid passing in null as the parent view, sinceotherwise any layout parameters on the root of the inflated layout will beignored.More information: http://www.doubleencore.com/2013/05/layout-inflation-as-intendedLogTagMismatch--------------Summary: Mismatched Log TagsPriority: 5 / 10Severity: ErrorCategory: CorrectnessWhen guarding a Log.v(tag, ...) call with Log.isLoggable(tag), the tag passedto both calls should be the same. Similarly, the level passed in toLog.isLoggable should typically match the type of Log call, e.g. if checkinglevel Log.DEBUG, the corresponding Log call should be Log.d, not Log.i.LongLogTag----------Summary: Too Long Log TagsPriority: 5 / 10Severity: ErrorCategory: CorrectnessLog tags are only allowed to be at most 23 tag characters long.ManifestOrder-------------Summary: Incorrect order of elements in manifestPriority: 5 / 10Severity: WarningCategory: CorrectnessThe <application> tag should appear after the elements which declare whichversion you need, which features you need, which libraries you need, and soon. In the past there have been subtle bugs (such as themes not gettingapplied correctly) when the <application> tag appears before some of theseother elements, so it's best to order your manifest in the logical dependencyorder.ManifestTypo------------Summary: Typos in manifest tagsPriority: 5 / 10Severity: FatalCategory: CorrectnessThis check looks through the manifest, and if it finds any tags that look likelikely misspellings, they are flagged.MissingId---------Summary: Fragments should specify an id or tagPriority: 5 / 10Severity: WarningCategory: CorrectnessIf 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 anorientation rotation) you may lose state. From the fragment documentation:"Each fragment requires a unique identifier that the system can use to restorethe fragment if the activity is restarted (and which you can use to capturethe 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 thecontainer view.More information: http://developer.android.com/guide/components/fragments.htmlNfcTechWhitespace-----------------Summary: Whitespace in NFC tech listsPriority: 5 / 10Severity: FatalCategory: CorrectnessIn a <tech-list>, there can be whitespace around the <tech> elements,but notinside them. This is because the code which reads in the tech list iscurrently very strict and will include the whitespace as part of the name.In other words, use <tech>name</tech>, not <tech> name </tech>.More information: https://code.google.com/p/android/issues/detail?id=65351ProtectedPermissions--------------------Summary: Using system app permissionPriority: 5 / 10Severity: ErrorCategory: CorrectnessPermissions with the protection level signature or signatureOrSystem are onlygranted to system apps. If an app is a regular non-system app, it will neverbe able to use these permissions.SQLiteString------------Summary: Using STRING instead of TEXTPriority: 5 / 10Severity: WarningCategory: CorrectnessIn SQLite, any column can store any data type; the declared type for a columnis more of a hint as to what the data should be cast to when stored.There are many ways to store a string. TEXT, VARCHAR, CHARACTER and CLOB arestring types, but `STRING` is not. Columns defined as STRING are actuallynumeric.If you try to store a value in a numeric column, SQLite will try to cast it toa float or an integer before storing. If it can't, it will just store it as astring.This can lead to some subtle bugs. For example, when SQLite encounters astring like 1234567e1234, it will parse it as a float, but the result will beout of range for floating point numbers, so Inf will be stored! Similarly,strings that look like integers will lose leading zeroes.To fix this, you can change your schema to use a TEXT type instead.More information: https://www.sqlite.org/datatype3.htmlStateListReachable------------------Summary: Unreachable state in a <selector>Priority: 5 / 10Severity: WarningCategory: CorrectnessIn a selector, only the last child in the state list should omit a statequalifier. If not, all subsequent items in the list will be ignored since thegiven item will match all.UnknownIdInLayout-----------------Summary: Reference to an id that is not in the current layoutPriority: 5 / 10Severity: WarningCategory: CorrectnessThe @+id/ syntax refers to an existing id, or creates a new one if it has notalready been defined elsewhere. However, this means that if you have a typo inyour reference, or if the referred view no longer exists, you do not get awarning since the id will be created on demand.This is sometimes intentional, for example where you are referring to a viewwhich is provided in a different layout via an include. However, it is usuallyan accident where you have a typo or you have renamed a view without updatingall the references to it.UnlocalizedSms--------------Summary: SMS phone number missing country codePriority: 5 / 10Severity: WarningCategory: CorrectnessSMS destination numbers must start with a country code or the application codemust ensure that the SMS is only sent when the user is in the same country asthe receiver.VectorRaster------------Summary: Vector Image GenerationPriority: 5 / 10Severity: WarningCategory: CorrectnessVector icons require API 21, but when using Android Gradle plugin 1.4 orhigher, vectors placed in the drawable folder are automatically moved todrawable-*dpi-v21 and a bitmap image is generated each drawable-*dpi folderinstead, for backwards compatibility (provided minSdkVersion is less than21.).However, there are some limitations to this vector image generation, and thislint check flags elements and attributes that are not fully supported. Youshould manually check whether the generated output is acceptable for thoseolder devices.GradleDependency----------------Summary: Obsolete Gradle DependencyPriority: 4 / 10Severity: WarningCategory: CorrectnessThis detector looks for usages of libraries where the version you are using isnot the current stable release. Using older versions is fine, and there arecases where you deliberately want to stick with an older version. However, youmay simply not be aware that a more recent version is available, and that iswhat this lint check helps find.GradleDynamicVersion--------------------Summary: Gradle Dynamic VersionPriority: 4 / 10Severity: WarningCategory: CorrectnessUsing + in dependencies lets you automatically pick up the latest availableversion rather than a specific, named version. However, this is notrecommended; your builds are not repeatable; you may have tested with aslightly different version than what the build server used. (Using a dynamicversion as the major version number is more problematic than using it in theminor version position.)GradleIdeError--------------Summary: Gradle IDE Support IssuesPriority: 4 / 10Severity: ErrorCategory: CorrectnessGradle is highly flexible, and there are things you can do in Gradle fileswhich can make it hard or impossible for IDEs to properly handle the project.This lint check looks for constructs that potentially break IDE support.GradleOverrides---------------Summary: Value overridden by Gradle build scriptPriority: 4 / 10Severity: WarningCategory: CorrectnessThe value of (for example) minSdkVersion is only used if it is not specifiedin 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 toavoid ambiguity.GradlePath----------Summary: Gradle Path IssuesPriority: 4 / 10Severity: WarningCategory: CorrectnessGradle build scripts are meant to be cross platform, so file paths useUnix-style path separators (a forward slash) rather than Windows pathseparators (a backslash). Similarly, to keep projects portable and repeatable,avoid using absolute paths on the system; keep files within the projectinstead. To share code between projects, consider creating an android-libraryand an AAR dependencyGridLayout----------Summary: GridLayout validationPriority: 4 / 10Severity: FatalCategory: CorrectnessDeclaring a layout_row or layout_column that falls outside the declared sizeof a GridLayout's rowCount or columnCount is usually an unintentional error.InOrMmUsage-----------Summary: Using mm or in dimensionsPriority: 4 / 10Severity: WarningCategory: CorrectnessAvoid using mm (millimeters) or in (inches) as the unit for dimensions.While it should work in principle, unfortunately many devices do not reportthe correct true physical density, which means that the dimension calculationswon't work correctly. You are better off using dp (and for font sizes, sp.)NewerVersionAvailable---------------------Summary: Newer Library Versions AvailablePriority: 4 / 10Severity: WarningCategory: CorrectnessNOTE: This issue is disabled by default!You can enable it by adding --enable NewerVersionAvailableThis detector checks with a central repository to see if there are newerversions available for the dependencies used by this project. This is similarto the GradleDependency check, which checks for newer versions available inthe Android SDK tools and libraries, but this works with any MavenCentraldependency, and connects to the library every time, which makes it moreflexible but also much slower.RequiredSize------------Summary: Missing layout_width or layout_height attributesPriority: 4 / 10Severity: ErrorCategory: CorrectnessAll views must specify an explicit layout_width and layout_height attribute.There is a runtime check for this, so if you fail to specify a size, anexception is thrown at runtime.It's possible to specify these widths via styles as well. GridLayout, as aspecial case, does not require you to specify a size.WrongCase---------Summary: Wrong case for view tagPriority: 4 / 10Severity: FatalCategory: CorrectnessMost layout tags, such as <Button>, refer to actual view classes and aretherefore capitalized. However, there are exceptions such as <fragment> and<include>. This lint check looks for incorrect capitalizations.More information: http://developer.android.com/guide/components/fragments.htmlExtraText---------Summary: Extraneous text in resource filesPriority: 3 / 10Severity: WarningCategory: CorrectnessLayout resource files should only contain elements and attributes. Any XMLtext content found in the file is likely accidental (and potentially dangerousif the text resembles XML and the developer believes the text to befunctional)InnerclassSeparator-------------------Summary: Inner classes should use $ rather than .Priority: 3 / 10Severity: WarningCategory: CorrectnessWhen you reference an inner class in a manifest file, you must use '$' insteadof '.' 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 isnot conventional.)LocalSuppress-------------Summary: @SuppressLint on invalid elementPriority: 3 / 10Severity: ErrorCategory: CorrectnessThe @SuppressAnnotation is used to suppress Lint warnings in Java files.However, while many lint checks analyzes the Java source code, where they canfind annotations on (for example) local variables, some checks are analyzingthe .class files. And in class files, annotations only appear on classes,fields and methods. Annotations placed on local variables disappear. If youattempt to suppress a lint error for a class-file based lint check, thesuppress annotation not work. You must move the annotation out to thesurrounding method.PrivateResource---------------Summary: Using private resourcesPriority: 3 / 10Severity: WarningCategory: CorrectnessPrivate resources should not be referenced; the may not be present everywhere,and even where they are they may disappear without notice.To fix this, copy the resource into your own project instead.ProguardSplit-------------Summary: Proguard.cfg file contains generic Android rulesPriority: 3 / 10Severity: WarningCategory: CorrectnessEarlier versions of the Android tools bundled a single proguard.cfg filecontaining a ProGuard configuration file suitable for Android shrinking andobfuscation. However, that version was copied into new projects, which meansthat it does not continue to get updated as we improve the default ProGuardrules for Android.In the new version of the tools, we have split the ProGuard configuration intotwo halves:* A simple configuration file containing only project-specific flags, in yourproject* A generic configuration file containing the recommended set of ProGuardoptions for Android projects. This generic file lives in the SDK installdirectory which means that it gets updated along with the tools.In order for this to work, the proguard.config property in theproject.properties file now refers to a path, so you can reference both thegeneric file as well as your own (and any additional files too).To migrate your project to the new setup, create a new proguard-project.txtfile in your project containing any project specific ProGuard flags as well asany customizations you have made, then update your project.properties file tocontain:proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-projec.txtShiftFlags----------Summary: Dangerous Flag Constant DeclarationPriority: 3 / 10Severity: WarningCategory: CorrectnessWhen defining multiple constants for use in flags, the recommended style is touse the form 1 << 2, 1 << 3, 1 << 4 and so on to ensure that the constants areunique and non-overlapping.SpUsage-------Summary: Using dp instead of sp for text sizesPriority: 3 / 10Severity: WarningCategory: CorrectnessWhen setting text sizes, you should normally use sp, or "scale-independentpixels". This is like the dp unit, but it is also scaled by the user's fontsize preference. It is recommend you use this unit when specifying font sizes,so they will be adjusted for both the screen density and the user'spreference.There are cases where you might need to use dp; typically this happens whenthe text is in a container with a specific dp-size. This will prevent the textfrom spilling outside the container. Note however that this means that theuser's font size settings are not respected, so consider adjusting the layoutitself to be more flexible.More information: http://developer.android.com/training/multiscreen/screendensities.htmlUniqueConstants---------------Summary: Overlapping Enumeration ConstantsPriority: 3 / 10Severity: ErrorCategory: CorrectnessThe @IntDef annotation allows you to create a light-weight "enum" or typedefinition. However, it's possible to accidentally specify the same value fortwo or more of the values, which can lead to hard-to-detect bugs. This checklooks for this scenario and flags any repeated constants.In some cases, the repeated constant is intentional (for example, renaming aconstant to a more intuitive name, and leaving the old name in place forcompatibility purposes.)  In that case, simply suppress this check by adding a@SuppressLint("UniqueConstants") annotation.AccidentalOctal---------------Summary: Accidental OctalPriority: 2 / 10Severity: ErrorCategory: CorrectnessIn Groovy, an integer literal that starts with a leading 0 will be interpretedas an octal number. That is usually (always?) an accident and can lead tosubtle bugs, for example when used in the versionCode of an app.Deprecated----------Summary: Using deprecated resourcesPriority: 2 / 10Severity: WarningCategory: CorrectnessDeprecated views, attributes and so on are deprecated because there is abetter way to do something. Do it that new way. You've been warned.MangledCRLF-----------Summary: Mangled file line endingsPriority: 2 / 10Severity: ErrorCategory: CorrectnessOn Windows, line endings are typically recorded as carriage return plusnewline: \r\n.This detector looks for invalid line endings with repeated carriage returncharacters (without newlines). Previous versions of the ADT plugin couldaccidentally introduce these into the file, and when editing the file, theeditor could produce confusing visual artifacts.More information: https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421MissingVersion--------------Summary: Missing application name/versionPriority: 2 / 10Severity: WarningCategory: CorrectnessYou should define the version information for your application.android:versionCode: An integer value that represents the version of theapplication code, relative to other versions.android:versionName: A string value that represents the release version of theapplication code, as it should be shown to users.More information: http://developer.android.com/tools/publishing/versioning.html#appversioningOrientation-----------Summary: Missing explicit orientationPriority: 2 / 10Severity: ErrorCategory: CorrectnessThe default orientation of a LinearLayout is horizontal. It's pretty easy tobelieve that the layout is vertical, add multiple children to it, and wonderwhy only the first child is visible (when the subsequent children are offscreen to the right). This lint rule helps pinpoint this issue by warningwhenever a LinearLayout is used with an implicit orientation and multiplechildren.It also checks for empty LinearLayouts without an orientation attribute thatalso defines an id attribute. This catches the scenarios where children willbe added to the LinearLayout dynamically. PxUsage-------Summary: Using 'px' dimensionPriority: 2 / 10Severity: WarningCategory: CorrectnessFor performance reasons and to keep the code simpler, the Android system usespixels as the standard unit for expressing dimension or coordinate values.That means that the dimensions of a view are always expressed in the codeusing pixels, but always based on the current screen density. For instance, ifmyView.getWidth() returns 10, the view is 10 pixels wide on the currentscreen, but on a device with a higher density screen, the value returned mightbe 15. If you use pixel values in your application code to work with bitmapsthat are not pre-scaled for the current screen density, you might need toscale the pixel values that you use in your code to match the un-scaled bitmapsource.More information: http://developer.android.com/guide/practices/screens_support.html#screen-independenceCorrectness:Messages====================StringFormatInvalid-------------------Summary: Invalid format stringPriority: 9 / 10Severity: ErrorCategory: Correctness:MessagesIf a string contains a '%' character, then the string may be a formattingstring which will be passed to String.format from Java code to replace each'%' occurrence with specific values.This lint warning checks for two related problems:(1) Formatting strings that are invalid, meaning that String.format will throwexceptions at runtime when attempting to use the format string.(2) Strings containing '%' that are not formatting strings getting passed to aString.format call. In this case the '%' will need to be escaped as '%%'.NOTE: Not all Strings which look like formatting strings are intended for useby String.format; for example, they may contain date formats intended forandroid.text.format.Time#format(). Lint cannot always figure out that a Stringis a date format, so you may get false warnings in those scenarios. See thesuppress help topic for information on how to suppress errors in that case.StringFormatMatches-------------------Summary: String.format string doesn't match the XML format stringPriority: 9 / 10Severity: ErrorCategory: Correctness:MessagesThis lint check ensures the following:(1) If there are multiple translations of the format string, then alltranslations use the same type for the same numbered arguments(2) The usage of the format string in Java is consistent with the formatstring, meaning that the parameter types passed to String.format matches thosein the format string.MissingQuantity---------------Summary: Missing quantity translationPriority: 8 / 10Severity: ErrorCategory: Correctness:MessagesDifferent languages have different rules for grammatical agreement withquantity. 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 distinctionbetween singular and plural is very common, but other languages make finerdistinctions.This lint check looks at each translation of a <plural> and makes sure thatall the quantity strings considered by the given language are provided by thistranslation.For example, an English translation must provide a string for quantity="one".Similarly, a Czech translation must provide a string for quantity="few".More information: http://developer.android.com/guide/topics/resources/string-resource.html#PluralsMissingTranslation------------------Summary: Incomplete translationPriority: 8 / 10Severity: FatalCategory: Correctness:MessagesIf an application has more than one locale, then all the strings declared inone language should also be translated in all other languages.If the string should not be translated, you can add the attributetranslatable="false" on the <string> element, or you can define all yournon-translatable strings in a resource file called donottranslate.xml. Or, youcan ignore the issue with a tools:ignore="MissingTranslation" attribute.By default this detector allows regions of a language to just provide a subsetof the strings and fall back to the standard language strings. You can requireall regions to provide a full translation by setting the environment variableANDROID_LINT_COMPLETE_REGIONS.You can tell lint (and other tools) which language is the default language inyour res/values/ folder by specifying tools:locale="languageCode" for the root<resources> element in your resource file. (The tools prefix refers to thenamespace declaration http://schemas.android.com/tools.)Typos-----Summary: Spelling errorPriority: 7 / 10Severity: WarningCategory: Correctness:MessagesThis check looks through the string definitions, and if it finds any wordsthat look like likely misspellings, they are flagged.ExtraTranslation----------------Summary: Extra translationPriority: 6 / 10Severity: FatalCategory: Correctness:MessagesIf a string appears in a specific language translation file, but there is nocorresponding string in the default locale, then this string is probablyunused. (It's technically possible that your application is only intended torun in a specific locale, but it's still a good idea to provide a fallback.).Note that these strings can lead to crashes if the string is looked up on anylocale not providing a translation, so it's important to clean them up.ImpliedQuantity---------------Summary: Implied QuantitiesPriority: 5 / 10Severity: ErrorCategory: Correctness:MessagesPlural strings should generally include a %s or %d formatting argument. Inlocales like English, the one quantity only applies to a single value, 1, butthat's not true everywhere. For example, in Slovene, the one quantity willapply to 1, 101, 201, 301, and so on. Similarly, there are locales wheremultiple values match the zero and two quantities.In these locales, it is usually an error to have a message which does notinclude a formatting argument (such as '%d'), since it will not be clear fromthe grammar what quantity the quantity string is describing.More information: http://developer.android.com/guide/topics/resources/string-resource.html#PluralsPluralsCandidate----------------Summary: Potential PluralsPriority: 5 / 10Severity: WarningCategory: Correctness:MessagesThis lint check looks for potential errors in internationalization where youhave translated a message which involves a quantity and it looks like otherparts of the string may need grammatical changes.For example, rather than something like this:  <string name="try_again">Try again in %d seconds.</string>you should be using a plural:   <plurals name="try_again">        <item quantity="one">Try again in %d second</item>        <item quantity="other">Try again in %d seconds</item>    </plurals>This will ensure that in other languages the right set of translations areprovided for the different quantity classes.(This check depends on some heuristics, so it may not accurately determinewhether a string really should be a quantity. You can use tools:ignore tofilter out false positives.More information: http://developer.android.com/guide/topics/resources/string-resource.html#PluralsStringFormatCount-----------------Summary: Formatting argument types incomplete or inconsistentPriority: 5 / 10Severity: WarningCategory: Correctness:MessagesWhen a formatted string takes arguments, it usually needs to reference thesame arguments in all translations (or all arguments if there are notranslations.There are cases where this is not the case, so this issue is a warning ratherthan an error by default. However, this usually happens when a language is nottranslated or updated correctly.UnusedQuantity--------------Summary: Unused quantity translationsPriority: 3 / 10Severity: WarningCategory: Correctness:MessagesAndroid defines a number of different quantity strings, such as zero, one, fewand many. However, many languages do not distinguish grammatically between allthese different quantities.This lint check looks at the quantity strings defined for each translation andflags any quantity strings that are unused (because the language does not makethat quantity distinction, and Android will therefore not look it up.).For example, in Chinese, only the other quantity is used, so even if youprovide translations for zero and one, these strings will not be returned whengetQuantityString() is called, even with 0 or 1.More information: http://developer.android.com/guide/topics/resources/string-resource.html#PluralsSecurity========AddJavascriptInterface----------------------Summary: addJavascriptInterface CalledPriority: 9 / 10Severity: WarningCategory: SecurityFor applications built for API levels below 17, WebView#addJavascriptInterfacepresents a security hazard as JavaScript on the target web page has theability to use reflection to access the injected object's public fields andthus manipulate the host application in unintended ways.More information: https://labs.mwrinfosecurity.com/blog/2013/09/24/webview-addjavascriptinterface-remote-code-execution/GetInstance-----------Summary: Cipher.getInstance with ECBPriority: 9 / 10Severity: WarningCategory: SecurityCipher#getInstance should not be called with ECB as the cipher mode or withoutsetting the cipher mode because the default mode on android is ECB, which isinsecure.SecureRandom------------Summary: Using a fixed seed with SecureRandomPriority: 9 / 10Severity: WarningCategory: SecuritySpecifying a fixed seed will cause the instance to return a predictablesequence of numbers. This may be useful for testing but it is not appropriatefor secure use.More information: http://developer.android.com/reference/java/security/SecureRandom.htmlTrulyRandom-----------Summary: Weak RNGPriority: 9 / 10Severity: WarningCategory: SecurityKey generation, signing, encryption, and random number generation may notreceive cryptographically strong values due to improper initialization of theunderlying PRNG on Android 4.3 and below.If your application relies on cryptographically secure random numbergeneration you should apply the workaround described inhttps://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.htm .This lint rule is mostly informational; it does not accurately detect whethercryptographically secure RNG is required, or whether the workaround hasalready been applied. After reading the blog entry and updating your code ifnecessary, you can disable this lint issue.More information: https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.htmlExportedPreferenceActivity--------------------------Summary: PreferenceActivity should not be exportedPriority: 8 / 10Severity: WarningCategory: SecurityFragment injection gives anyone who can send your PreferenceActivity an intentthe ability to load any fragment, with any arguments, in your process.More information: http://securityintelligence.com/new-vulnerability-android-framework-fragment-injectionJavascriptInterface-------------------Summary: Missing @JavascriptInterface on methodsPriority: 8 / 10Severity: ErrorCategory: SecurityAs of API 17, you must annotate methods in objects registered with theaddJavascriptInterface method with a @JavascriptInterface annotation.More information: http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String)PackageManagerGetSignatures---------------------------Summary: Potential Multiple Certificate ExploitPriority: 8 / 10Severity: InformationCategory: SecurityImproper validation of app signatures could lead to issues where a maliciousapp submits itself to the Play Store with both its real certificate and a fakecertificate and gains access to functionality or information it shouldn't havedue to another application only checking for the fake certificate and ignoringthe rest. Please make sure to validate all signatures returned by thismethod.More information: https://bluebox.com/technical/android-fake-id-vulnerability/PackagedPrivateKey------------------Summary: Packaged private keyPriority: 8 / 10Severity: FatalCategory: SecurityIn general, you should not package private key files inside your app.GrantAllUris------------Summary: Content provider shares everythingPriority: 7 / 10Severity: WarningCategory: SecurityThe <grant-uri-permission> element allows specific paths to be shared. Thisdetector checks for a path URL of just '/' (everything), which is probably notwhat you want; you should limit access to a subset.EasterEgg---------Summary: Code contains easter eggPriority: 6 / 10Severity: WarningCategory: SecurityNOTE: This issue is disabled by default!You can enable it by adding --enable EasterEggAn "easter egg" is code deliberately hidden in the code, both from potentialusers and even from other developers. This lint check looks for code whichlooks like it may be hidden from sight.SetJavaScriptEnabled--------------------Summary: Using setJavaScriptEnabledPriority: 6 / 10Severity: WarningCategory: SecurityYour code should not invoke setJavaScriptEnabled if you are not sure that yourapp really requires JavaScript support.More information: http://developer.android.com/guide/practices/security.htmlUseCheckPermission------------------Summary: Using the result of check permission callsPriority: 6 / 10Severity: WarningCategory: SecurityYou normally want to use the result of checking a permission; these methodsreturn whether the permission is held; they do not throw an error if thepermission is not granted. Code which does not do anything with the returnvalue probably meant to be calling the enforce methods instead, e.g. ratherthan Context#checkCallingPermission it should callContext#enforceCallingPermission.UsingHttp---------Summary: Using HTTP instead of HTTPSPriority: 6 / 10Severity: WarningCategory: SecurityThe Gradle Wrapper is available both via HTTP and HTTPS. HTTPS is more securesince it protects against man-in-the-middle attacks etc. Older projectscreated in Android Studio used HTTP but we now default to HTTPS and recommendupgrading existing projects.WrongConstant-------------Summary: Incorrect constantPriority: 6 / 10Severity: ErrorCategory: SecurityEnsures that when parameter in a method only allows a specific set ofconstants, calls obey those rules.ExportedContentProvider-----------------------Summary: Content provider does not require permissionPriority: 5 / 10Severity: WarningCategory: SecurityContent providers are exported by default and any application on the systemcan potentially use them to read and write data. If the content providerprovides access to sensitive data, it should be protected by specifyingexport=false in the manifest or by protecting it with a permission that can begranted to other applications.ExportedReceiver----------------Summary: Receiver does not require permissionPriority: 5 / 10Severity: WarningCategory: SecurityExported receivers (receivers which either set exported=true or contain anintent-filter and do not specify exported=false) should define a permissionthat an entity must have in order to launch the receiver or bind to it.Without this, any application can use this receiver.ExportedService---------------Summary: Exported service does not require permissionPriority: 5 / 10Severity: WarningCategory: SecurityExported services (services which either set exported=true or contain anintent-filter and do not specify exported=false) should define a permissionthat an entity must have in order to launch the service or bind to it. Withoutthis, any application can use this service.HardcodedDebugMode------------------Summary: Hardcoded value of android:debuggable in the manifestPriority: 5 / 10Severity: FatalCategory: SecurityIt's best to leave out the android:debuggable attribute from the manifest. Ifyou do, then the tools will automatically insert android:debuggable=true whenbuilding an APK to debug on an emulator or device. And when you perform arelease build, such as Exporting APK, it will automatically set it to false.If on the other hand you specify a specific value in the manifest file, thenthe tools will always use it. This can lead to accidentally publishing yourapp with debug information.SignatureOrSystemPermissions----------------------------Summary: signatureOrSystem permissions declaredPriority: 5 / 10Severity: WarningCategory: SecurityThe signature protection level should probably be sufficient for most needsand works regardless of where applications are installed. ThesignatureOrSystem level is used for certain situations where multiple vendorshave applications built into a system image and need to share specificfeatures explicitly because they are being built together.WorldReadableFiles------------------Summary: openFileOutput() call passing MODE_WORLD_READABLEPriority: 4 / 10Severity: WarningCategory: SecurityThere are cases where it is appropriate for an application to write worldreadable files, but these should be reviewed carefully to ensure that theycontain no private data that is leaked to other applications.WorldWriteableFiles-------------------Summary: openFileOutput() call passing MODE_WORLD_WRITEABLEPriority: 4 / 10Severity: WarningCategory: SecurityThere are cases where it is appropriate for an application to write worldwriteable files, but these should be reviewed carefully to ensure that theycontain no private data, and that if the file is modified by a maliciousapplication it does not trick or compromise your application.AllowBackup-----------Summary: AllowBackup/FullBackupContent ProblemsPriority: 3 / 10Severity: WarningCategory: SecurityThe allowBackup attribute determines if an application's data can be backed upand restored. It is documented athttp://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 backupand adb restore.This may have security consequences for an application. adb backup allowsusers who have enabled USB debugging to copy application data off of thedevice. Once backed up, all application data can be read by the user. adbrestore allows creation of application data from a source specified by theuser. Following a restore, applications should not assume that the data, filepermissions, and directory permissions were created by the applicationitself.Setting allowBackup="false" opts an application out of both backup andrestore.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 warnthat you should set android:fullBackupContent to configure auto backup.More information: https://developer.android.com/preview/backup/index.htmlhttp://developer.android.com/reference/android/R.attr.html#allowBackupPerformance===========DrawAllocation--------------Summary: Memory allocations within drawing codePriority: 9 / 10Severity: WarningCategory: PerformanceYou should avoid allocating objects during a drawing or layout operation.These are called frequently, so a smooth UI can be interrupted by garbagecollection pauses caused by the object allocations.The way this is generally handled is to allocate the needed objects up frontand to reuse them for each drawing operation.Some methods allocate memory on your behalf (such as Bitmap.create), and theseshould be handled in the same way.Wakelock--------Summary: Incorrect WakeLock usagePriority: 9 / 10Severity: WarningCategory: PerformanceFailing to release a wakelock properly can keep the Android device in a highpower mode, which reduces battery life. There are several causes of this, suchas releasing the wake lock in onDestroy() instead of in onPause(), failing tocall release() in all possible code paths after an acquire(), and so on.NOTE: If you are using the lock just to keep the screen on, you shouldstrongly consider using FLAG_KEEP_SCREEN_ON instead. This window flag will becorrectly managed by the platform as the user moves between applications anddoesn't require a special permission. Seehttp://developer.android.com/reference/android/view/WindowManager.LayoutParamshtml#FLAG_KEEP_SCREEN_ON.Recycle-------Summary: Missing recycle() callsPriority: 7 / 10Severity: WarningCategory: PerformanceMany resources, such as TypedArrays, VelocityTrackers, etc., should berecycled (with a recycle() call) after use. This lint check looks for missingrecycle() calls.ObsoleteLayoutParam-------------------Summary: Obsolete layout paramsPriority: 6 / 10Severity: WarningCategory: PerformanceThe given layout_param is not defined for the given layout, meaning it has noeffect. This usually happens when you change the parent layout or move viewcode around without updating the layout params. This will cause uselessattribute processing at runtime, and is misleading for others reading thelayout so the parameter should be removed.UseCompoundDrawables--------------------Summary: Node can be replaced by a TextView with compound drawablesPriority: 6 / 10Severity: WarningCategory: PerformanceA LinearLayout which contains an ImageView and a TextView can be moreefficiently handled as a compound drawable (a single TextView, using thedrawableTop, drawableLeft, drawableRight and/or drawableBottom attributes todraw one or more images adjacent to the text).If the two widgets are offset from each other with margins, this can bereplaced with a drawablePadding attribute.There's a lint quickfix to perform this conversion in the Eclipse plugin.ViewTag-------Summary: Tagged object leaksPriority: 6 / 10Severity: WarningCategory: PerformancePrior to Android 4.0, the implementation of View.setTag(int, Object) wouldstore the objects in a static map, where the values were strongly referenced.This means that if the object contains any references pointing back to thecontext, the context (which points to pretty much everything else) will leak.If you pass a view, the view provides a reference to the context that createdit. Similarly, view holders typically contain a view, and cursors aresometimes also associated with views.LogConditional--------------Summary: Unconditional Logging CallsPriority: 5 / 10Severity: WarningCategory: PerformanceNOTE: This issue is disabled by default!You can enable it by adding --enable LogConditionalThe BuildConfig class (available in Tools 17) provides a constant, "DEBUG",which indicates whether the code is being built in release mode or in debugmode. 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 forBuildConfig.DEBUG is a good idea.If you really intend for the logging to be present in release mode, you cansuppress this warning with a @SuppressLint annotation for the intentionallogging calls.ViewHolder----------Summary: View Holder CandidatesPriority: 5 / 10Severity: WarningCategory: PerformanceWhen implementing a view Adapter, you should avoid unconditionally inflating anew layout; if an available item is passed in for reuse, you should try to usethat one instead. This helps make for example ListView scrolling muchsmoother.More information: http://developer.android.com/training/improving-layouts/smooth-scrolling.html#ViewHolderFieldGetter-----------Summary: Using getter instead of fieldPriority: 4 / 10Severity: WarningCategory: PerformanceNOTE: This issue is disabled by default!You can enable it by adding --enable FieldGetterAccessing a field within the class that defines a getter for that field is atleast 3 times faster than calling the getter. For simple getters that donothing other than return the field, you might want to just reference thelocal field directly instead.NOTE: As of Android 2.3 (Gingerbread), this optimization is performedautomatically by Dalvik, so there is no need to change your code; this is onlyrelevant if you are targeting older versions of Android.More information: http://developer.android.com/guide/practices/design/performance.html#internal_get_setHandlerLeak-----------Summary: Handler reference leaksPriority: 4 / 10Severity: WarningCategory: PerformanceSince this Handler is declared as an inner class, it may prevent the outerclass from being garbage collected. If the Handler is using a Looper orMessageQueue 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, youneed to fix your Handler declaration, as follows: Declare the Handler as astatic class; In the outer class, instantiate a WeakReference to the outerclass and pass this object to your Handler when you instantiate the Handler;Make all references to members of the outer class using the WeakReferenceobject.MergeRootFrame--------------Summary: FrameLayout can be replaced with <merge> tagPriority: 4 / 10Severity: WarningCategory: PerformanceIf a <FrameLayout> is the root of a layout and does not provide background orpadding etc, it can often be replaced with a <merge> tag which is slightlymore efficient. Note that this depends on context, so make sure you understandhow the <merge> tag works before proceeding.More information: http://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-by.htmlUseSparseArrays---------------Summary: HashMap can be replaced with SparseArrayPriority: 4 / 10Severity: WarningCategory: PerformanceFor maps where the keys are of type integer, it's typically more efficient touse the Android SparseArray API. This check identifies scenarios where youmight want to consider using SparseArray instead of HashMap for betterperformance.This is particularly useful when the value types are primitives like ints,where you can use SparseIntArray and avoid auto-boxing the values from int toInteger.If you need to construct a HashMap because you need to call an API outside ofyour control which requires a Map, you can suppress this warning using forexample the @SuppressLint annotation.UseValueOf----------Summary: Should use valueOf instead of newPriority: 4 / 10Severity: WarningCategory: PerformanceYou should not call the constructor for wrapper classes directly, such as`newInteger(42)`. Instead, call the valueOf factory method, such asInteger.valueOf(42). This will typically use less memory because commonintegers such as 0 and 1 will share a single instance.DisableBaselineAlignment------------------------Summary: Missing baselineAligned attributePriority: 3 / 10Severity: WarningCategory: PerformanceWhen a LinearLayout is used to distribute the space proportionally betweennested layouts, the baseline alignment property should be turned off to makethe layout computation faster.FloatMath---------Summary: Using FloatMath instead of MathPriority: 3 / 10Severity: WarningCategory: PerformanceIn older versions of Android, using android.util.FloatMath was recommended forperformance reasons when operating on floats. However, on modern hardwaredoubles are just as fast as float (though they take more memory), and inrecent versions of Android, FloatMath is actually slower than usingjava.lang.Math due to the way the JIT optimizes java.lang.Math. Therefore, youshould use Math instead of FloatMath if you are only targeting Froyo andabove.More information: http://developer.android.com/guide/practices/design/performance.html#avoidfloatInefficientWeight-----------------Summary: Inefficient layout weightPriority: 3 / 10Severity: WarningCategory: PerformanceWhen only a single widget in a LinearLayout defines a weight, it is moreefficient to assign a width/height of 0dp to it since it will absorb all theremaining space anyway. With a declared width/height of 0dp it does not haveto measure its own size first.NestedWeights-------------Summary: Nested layout weightsPriority: 3 / 10Severity: WarningCategory: PerformanceLayout weights require a widget to be measured twice. When a LinearLayout withnon-zero weights is nested inside another LinearLayout with non-zero weights,then the number of measurements increase exponentially.Overdraw--------Summary: Overdraw: Painting regions more than oncePriority: 3 / 10Severity: WarningCategory: PerformanceIf you set a background drawable on a root view, then you should use a customtheme where the theme background is null. Otherwise, the theme background willbe painted first, only to have your custom background completely cover it;this is called "overdraw".NOTE: This detector relies on figuring out which layouts are associated withwhich activities based on scanning the Java code, and it's currently doingthat using an inexact pattern matching algorithm. Therefore, it canincorrectly conclude which activity the layout is associated with and thenwrongly complain that a background-theme is hidden.If you want your custom background on multiple pages, then you should considermaking a custom theme with your custom background and just using that themeinstead of a root element background.Of course it's possible that your custom drawable is translucent and you wantit to be mixed with the background. However, you will get better performanceif you pre-mix the background with your drawable and use that resulting imageor color as a custom theme background instead.UnusedResources---------------Summary: Unused resourcesPriority: 3 / 10Severity: WarningCategory: PerformanceUnused resources make applications larger and slow down builds.UselessLeaf-----------Summary: Useless leaf layoutPriority: 2 / 10Severity: WarningCategory: PerformanceA layout that has no children or no background can often be removed (since itis invisible) for a flatter and more efficient layout hierarchy.UselessParent-------------Summary: Useless parent layoutPriority: 2 / 10Severity: WarningCategory: PerformanceA layout with children that has no siblings, is not a scrollview or a rootlayout, and does not have a background, can be removed and have its childrenmoved directly into the parent for a flatter and more efficient layouthierarchy.TooDeepLayout-------------Summary: Layout hierarchy is too deepPriority: 1 / 10Severity: WarningCategory: PerformanceLayouts with too much nesting is bad for performance. Consider using a flatterlayout (such as RelativeLayout or GridLayout).The default maximum depth is 10but can be configured with the environment variable ANDROID_LINT_MAX_DEPTH.TooManyViews------------Summary: Layout has too many viewsPriority: 1 / 10Severity: WarningCategory: PerformanceUsing too many views in a single layout is bad for performance. Consider usingcompound drawables or other tricks for reducing the number of views in thislayout.The maximum view count defaults to 80 but can be configured with theenvironment variable ANDROID_LINT_MAX_VIEW_COUNT.UnusedIds---------Summary: Unused idPriority: 1 / 10Severity: WarningCategory: PerformanceNOTE: This issue is disabled by default!You can enable it by adding --enable UnusedIdsThis resource id definition appears not to be needed since it is notreferenced from anywhere. Having id definitions, even if unused, is notnecessarily a bad idea since they make working on layouts and menus easier, sothere is not a strong reason to delete these.UnusedNamespace---------------Summary: Unused namespacePriority: 1 / 10Severity: WarningCategory: PerformanceUnused namespace declarations take up space and require processing that is notnecessaryUsability:Typography====================TypographyDashes----------------Summary: Hyphen can be replaced with dashPriority: 5 / 10Severity: WarningCategory: Usability:TypographyThe "n dash" (–, &#8211;) and the "m dash" (—, &#8212;) characters are usedfor ranges (n dash) and breaks (m dash). Using these instead of plain hyphenscan make text easier to read and your application will look more polished.More information: http://en.wikipedia.org/wiki/DashTypographyEllipsis------------------Summary: Ellipsis string can be replaced with ellipsis characterPriority: 5 / 10Severity: WarningCategory: Usability:TypographyYou can replace the string "..." with a dedicated ellipsis character, ellipsischaracter (…, &#8230;). This can help make the text more readable.More information: http://en.wikipedia.org/wiki/EllipsisTypographyFractions-------------------Summary: Fraction string can be replaced with fraction characterPriority: 5 / 10Severity: WarningCategory: Usability:TypographyYou can replace certain strings, such as 1/2, and 1/4, with dedicatedcharacters for these, such as ? (&#189;) and ? (&#188;). This can help makethe text more readable.More information: http://en.wikipedia.org/wiki/Number_FormsTypographyQuotes----------------Summary: Straight quotes can be replaced with curvy quotesPriority: 5 / 10Severity: WarningCategory: Usability:TypographyNOTE: This issue is disabled by default!You can enable it by adding --enable TypographyQuotesStraight single quotes and double quotes, when used as a pair, can be replacedby "curvy quotes" (or directional quotes). This can make the text morereadable.Note that you should never use grave accents and apostrophes to quote, `likethis'.(Also note that you should not use curvy quotes for code fragments.)More information: http://en.wikipedia.org/wiki/Quotation_markTypographyOther---------------Summary: Other typographical problemsPriority: 3 / 10Severity: WarningCategory: Usability:TypographyThis check looks for miscellaneous typographical problems and offersreplacement sequences that will make the text easier to read and yourapplication more polished.Usability:Icons===============IconNoDpi---------Summary: Icon appears in both -nodpi and dpi foldersPriority: 7 / 10Severity: WarningCategory: Usability:IconsBitmaps that appear in drawable-nodpi folders will not be scaled by theAndroid 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 behavioris ambiguous and probably not intentional. Delete one or the other, or usedifferent names for the icons.IconXmlAndPng-------------Summary: Icon is specified both as .xml file and as a bitmapPriority: 7 / 10Severity: WarningCategory: Usability:IconsIf a drawable resource appears as an .xml file in the drawable/ folder, it'susually 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 hasa corresponding drawable bitmap.IconColors----------Summary: Icon colors do not follow the recommended visual stylePriority: 6 / 10Severity: WarningCategory: Usability:IconsNotification 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 decideswhether an icon is an action bar icon or a notification icon is based on thefilename prefix: ic_menu_ for action bar icons, ic_stat_ for notificationicons etc. These correspond to the naming conventions documented inhttp://developer.android.com/guide/practices/ui_guidelines/icon_design.htmlMore information: http://developer.android.com/design/style/iconography.htmlIconLauncherShape-----------------Summary: The launcher icon shape should use a distinct silhouettePriority: 6 / 10Severity: WarningCategory: Usability:IconsAccording to the Android Design Guide(http://developer.android.com/design/style/iconography.html) your launchericons should "use a distinct silhouette", a "three-dimensional, front view,with a slight perspective as if viewed from above, so that users perceive somedepth."The unique silhouette implies that your launcher icon should not be a filledsquare.More information: http://developer.android.com/design/style/iconography.htmlGifUsage--------Summary: Using .gif format for bitmaps is discouragedPriority: 5 / 10Severity: WarningCategory: Usability:IconsThe .gif file format is discouraged. Consider using .png (preferred) or .jpg(acceptable) instead.More information: http://developer.android.com/guide/topics/resources/drawable-resource.html#BitmapIconDipSize-----------Summary: Icon density-independent size validationPriority: 5 / 10Severity: WarningCategory: Usability:IconsChecks the all icons which are provided in multiple densities, all compute toroughly the same density-independent pixel (dip) size. This catches errorswhere images are either placed in the wrong folder, or icons are changed tonew sizes but some folders are forgotten.IconDuplicatesConfig--------------------Summary: Identical bitmaps across various configurationsPriority: 5 / 10Severity: WarningCategory: Usability:IconsIf an icon is provided under different configuration parameters such asdrawable-hdpi or -v11, they should typically be different. This detectorcatches cases where the same icon is provided in different configurationfolder which is usually not intentional.IconExpectedSize----------------Summary: Icon has incorrect sizePriority: 5 / 10Severity: WarningCategory: Usability:IconsNOTE: This issue is disabled by default!You can enable it by adding --enable IconExpectedSizeThere are predefined sizes (for each density) for launcher icons. You shouldfollow these conventions to make sure your icons fit in with the overall lookof the platform.More information: http://developer.android.com/design/style/iconography.htmlIconLocation------------Summary: Image defined in density-independent drawable folderPriority: 5 / 10Severity: WarningCategory: Usability:IconsThe res/drawable folder is intended for density-independent graphics such asshapes defined in XML. For bitmaps, move it to drawable-mdpi and considerproviding higher and lower resolution versions in drawable-ldpi, drawable-hdpiand drawable-xhdpi. If the icon really is density independent (for example asolid color) you can place it in drawable-nodpi.More information: http://developer.android.com/guide/practices/screens_support.htmlIconMixedNinePatch------------------Summary: Clashing PNG and 9-PNG filesPriority: 5 / 10Severity: WarningCategory: Usability:IconsIf you accidentally name two separate resources file.png and file.9.png, theimage file and the nine patch file will both map to the same drawableresource, @drawable/file, which is probably not what was intended.MipmapIcons-----------Summary: Use Mipmap Launcher IconsPriority: 5 / 10Severity: WarningCategory: Usability:IconsLauncher icons should be provided in the mipmap resource directory. This isthe same as the drawable resource directory, except resources in the mipmapdirectory will not get stripped out when creating density-specific APKs.In certain cases, the Launcher app may use a higher resolution asset (thanwould normally be computed for the device) to display large app shortcuts. Ifdrawables for densities other than the device's resolution have been strippedout, then the app shortcut could appear blurry.To fix this, move your launcher icons from `drawable-`dpi to `mipmap-`dpi andchange references from @drawable/ and R.drawable to @mipmap/ and R.mipmap.In Android Studio this lint warning has a quickfix to perform thisautomatically.MissingApplicationIcon----------------------Summary: Missing application iconPriority: 5 / 10Severity: WarningCategory: Usability:IconsYou should set an icon for the application as whole because there is nodefault. This attribute must be set as a reference to a drawable resourcecontaining the image (for example @drawable/icon).More information: http://developer.android.com/tools/publishing/preparing.html#publishing-configureIconDensities-------------Summary: Icon densities validationPriority: 4 / 10Severity: WarningCategory: Usability:IconsIcons will look best if a custom version is provided for each of the majorscreen density classes (low, medium, high, extra high). This lint checkidentifies icons which do not have complete coverage across the densities.Low density is not really used much anymore, so this check ignores the ldpidensity. To force lint to include it, set the environment variableANDROID_LINT_INCLUDE_LDPI=true. For more information on current density usage,see http://developer.android.com/resources/dashboard/screens.htmlMore information: http://developer.android.com/guide/practices/screens_support.htmlIconDuplicates--------------Summary: Duplicated icons under different namesPriority: 3 / 10Severity: WarningCategory: Usability:IconsIf an icon is repeated under different names, you can consolidate and just useone of the icons and delete the others to make your application smaller.However, duplicated icons usually are not intentional and can sometimes pointto icons that were accidentally overwritten or accidentally not updated.IconExtension-------------Summary: Icon format does not match the file extensionPriority: 3 / 10Severity: WarningCategory: Usability:IconsEnsures that icons have the correct file extension (e.g. a .png file is reallyin the PNG format and not for example a GIF file named .png.)IconMissingDensityFolder------------------------Summary: Missing density folderPriority: 3 / 10Severity: WarningCategory: Usability:IconsIcons will look best if a custom version is provided for each of the majorscreen density classes (low, medium, high, extra-high, extra-extra-high). Thislint check identifies folders which are missing, such as drawable-hdpi.Low density is not really used much anymore, so this check ignores the ldpidensity. To force lint to include it, set the environment variableANDROID_LINT_INCLUDE_LDPI=true. For more information on current density usage,see http://developer.android.com/resources/dashboard/screens.htmlMore information: http://developer.android.com/guide/practices/screens_support.htmlUsability=========ButtonOrder-----------Summary: Button orderPriority: 8 / 10Severity: WarningCategory: UsabilityAccording to the Android Design Guide,"Action buttons are typically Cancel and/or OK, with OK indicating thepreferred or most likely action. However, if the options consist of specificactions such as Close or Wait rather than a confirmation or cancellation ofthe action described in the content, then all the buttons should be activeverbs. As a rule, the dismissive action of a dialog is always on the leftwhereas 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.More information: http://developer.android.com/design/building-blocks/dialogs.htmlSelectableText--------------Summary: Dynamic text should probably be selectablePriority: 7 / 10Severity: WarningCategory: UsabilityNOTE: This issue is disabled by default!You can enable it by adding --enable SelectableTextIf a <TextView> is used to display data, the user might want to copy that dataand paste it elsewhere. To allow this, the <TextView> should specifyandroid:textIsSelectable="true".This lint check looks for TextViews which are likely to be displaying data:views whose text is set dynamically. This value will be ignored on platformsolder than API 11, so it is okay to set it regardless of your minSdkVersion.BackButton----------Summary: Back buttonPriority: 6 / 10Severity: WarningCategory: UsabilityNOTE: This issue is disabled by default!You can enable it by adding --enable BackButtonAccording to the Android Design Guide,"Other platforms use an explicit back button with label to allow the user tonavigate up the application's hierarchy. Instead, Android uses the main actionbar's app icon for hierarchical navigation and the navigation bar's backbutton 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 likepairs of Back/Next buttons to paginate through screens.More information: http://developer.android.com/design/patterns/pure-android.htmlAppCompatResource-----------------Summary: Menu namespacePriority: 5 / 10Severity: ErrorCategory: UsabilityWhen using the appcompat library, menu resources should refer to theshowAsAction in the app: namespace, not the android: namespace.Similarly, when not using the appcompat library, you should be using theandroid:showAsAction attribute.AppIndexingError----------------Summary: Wrong Usage of App IndexingPriority: 5 / 10Severity: ErrorCategory: UsabilityEnsures the app can correctly handle deep links and integrate with AppIndexing for Google search.More information: https://g.co/AppIndexingAppIndexingWarning------------------Summary: Missing App Indexing SupportPriority: 5 / 10Severity: WarningCategory: UsabilityEnsures the app can correctly handle deep links and integrate with AppIndexing for Google search.More information: https://g.co/AppIndexingButtonStyle-----------Summary: Button should be borderlessPriority: 5 / 10Severity: WarningCategory: UsabilityButton bars typically use a borderless style for the buttons. Set thestyle="?android:attr/buttonBarButtonStyle" attribute on each of the buttons,and set style="?android:attr/buttonBarStyle" on the parent layoutMore information: http://developer.android.com/design/building-blocks/buttons.htmlMenuTitle---------Summary: Missing menu titlePriority: 5 / 10Severity: ErrorCategory: UsabilityFrom the action bar documentation:"It's important that you always define android:title for each menu item — evenif you don't declare that the title appear with the action item — for threereasons:* If there's not enough room in the action bar for the action item, the menuitem 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 theitem to reveal a tool-tip that displays the action item's title.The android:icon is always optional, but recommended.More information: http://developer.android.com/guide/topics/ui/actionbar.htmlTextFields----------Summary: Missing inputType or hintPriority: 5 / 10Severity: WarningCategory: UsabilityProviding an inputType attribute on a text field improves usability becausedepending on the data to be input, optimized keyboards can be shown to theuser (such as just digits and parentheses for a phone number). Similarly,ahint attribute displays a hint to the user for what is expected in the textfield.The lint detector also looks at the id of the view, and if the id offers ahint of the purpose of the field (for example, the id contains the phrasephone or email), then lint will also ensure that the inputType contains thecorresponding type attributes.If you really want to keep the text field generic, you can suppress thiswarning by setting inputType="text".NegativeMargin--------------Summary: Negative MarginsPriority: 4 / 10Severity: WarningCategory: UsabilityNOTE: This issue is disabled by default!You can enable it by adding --enable NegativeMarginMargin values should be positive. Negative values are generally a sign thatyou are making assumptions about views surrounding the current one, or may betempted 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 graphicalperformance, it also results in wrong touch event handling since touch eventsare based strictly on a chain of parent-rect hit tests. Finally, makingassumptions about the size of strings can lead to localization problems.SmallSp-------Summary: Text size is too smallPriority: 4 / 10Severity: WarningCategory: UsabilityAvoid using sizes smaller than 12sp.AlwaysShowAction----------------Summary: Usage of showAsAction=alwaysPriority: 3 / 10Severity: WarningCategory: UsabilityUsing showAsAction="always" in menu XML, or MenuItem.SHOW_AS_ACTION_ALWAYS inJava code is usually a deviation from the user interface style guide.UseifRoom or the corresponding MenuItem.SHOW_AS_ACTION_IF_ROOM instead.If always is used sparingly there are usually no problems and behavior isroughly 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 forprojects that contain references to MenuItem.SHOW_AS_ACTION_ALWAYS and noreferences to MenuItem.SHOW_AS_ACTION_IF_ROOM.More information: http://developer.android.com/design/patterns/actionbar.htmlParcelCreator-------------Summary: Missing Parcelable CREATOR fieldPriority: 3 / 10Severity: ErrorCategory: UsabilityAccording to the Parcelable interface documentation, "Classes implementing theParcelable interface must also have a static field called CREATOR, which is anobject implementing the Parcelable.Creator interface.More information: http://developer.android.com/reference/android/os/Parcelable.htmlViewConstructor---------------Summary: Missing View constructors for XML inflationPriority: 3 / 10Severity: WarningCategory: UsabilitySome layout tools (such as the Android layout editor for Studio & Eclipse)needs to find a constructor with one of the following signatures:* View(Context context)* View(Context context, AttributeSet attrs)* View(Context context, AttributeSet attrs, int defStyle)If your custom view needs to perform initialization which does not apply whenused in a layout editor, you can surround the given code with a check to seeif View#isInEditMode() is false, since that method will return false atruntime but true within a user interface editor.ButtonCase----------Summary: Cancel/OK dialog button capitalizationPriority: 2 / 10Severity: WarningCategory: UsabilityThe standard capitalization for OK/Cancel dialogs is "OK" and "Cancel". Toensure that your dialogs use the standard strings, you can use the resourcestrings @android:string/ok and @android:string/cancel.Accessibility=============ClickableViewAccessibility--------------------------Summary: Accessibility in Custom ViewsPriority: 6 / 10Severity: WarningCategory: AccessibilityIf a View that overrides onTouchEvent or uses an OnTouchListener does not alsoimplement performClick and call it when clicks are detected, the View may nothandle accessibility actions properly. Logic handling the click actions shouldideally be placed in View#performClick as some accessibility services invokeperformClick when a click action should occur.ContentDescription------------------Summary: Image without contentDescriptionPriority: 3 / 10Severity: WarningCategory: AccessibilityNon-textual widgets like ImageViews and ImageButtons should use thecontentDescription attribute to specify a textual description of the widgetsuch that screen readers and other accessibility tools can adequately describethe user interface.Note that elements in application screens that are purely decorative and donot provide any content or enable a user action should not have accessibilitycontent descriptions. In this case, just suppress the lint warning with atools:ignore="ContentDescription" attribute.Note that for text fields, you should not set both the hint and thecontentDescription attributes since the hint will never be shown. Just set thehint. Seehttp://developer.android.com/guide/topics/ui/accessibility/checklist.html#specal-cases.LabelFor--------Summary: Missing labelFor attributePriority: 2 / 10Severity: WarningCategory: AccessibilityText fields should be labelled with a labelFor attribute, provided yourminSdkVersion is at least 17.If your view is labeled but by a label in a different layout which includesthis one, just suppress this warning from lint.Internationalization====================ByteOrderMark-------------Summary: Byte order mark inside filesPriority: 8 / 10Severity: FatalCategory: InternationalizationLint will flag any byte-order-mark (BOM) characters it finds in the middle ofa file. Since we expect files to be encoded with UTF-8 (see the EnforceUTF8issue), the BOM characters are not necessary, and they are not handledcorrectly by all tools. For example, if you have a BOM as part of a resourcename in one particular translation, that name will not be considered identicalto the base resource's name and the translation will not be used.More information: http://en.wikipedia.org/wiki/Byte_order_markSetTextI18n-----------Summary: TextView InternationalizationPriority: 6 / 10Severity: WarningCategory: InternationalizationWhen calling TextView#setText* Never call Number#toString() to format numbers; it will not handle fractionseparators and locale-specific digits properly. Consider using String#formatwith proper format specifications (%d or %f) instead.* Do not pass a string literal (e.g. "Hello") to display text. Hardcoded textcan not be properly translated to other languages. Consider using Androidresource strings instead.* Do not build messages by concatenating text chunks. Such messages can not beproperly translated.More information: http://developer.android.com/guide/topics/resources/localization.htmlEnforceUTF8-----------Summary: Encoding used in resource files is not UTF-8Priority: 5 / 10Severity: FatalCategory: InternationalizationXML supports encoding in a wide variety of character sets. However, not alltools handle the XML encoding attribute correctly, and nearly all Android appsuse UTF-8, so by using UTF-8 you can protect yourself against subtle bugs whenusing non-ASCII characters.In particular, the Android Gradle build system will merge resource XML filesassuming the resource files are using UTF-8 encoding.HardcodedText-------------Summary: Hardcoded textPriority: 5 / 10Severity: WarningCategory: InternationalizationHardcoding text attributes directly in layout files is bad for severalreasons:* When creating configuration variations (for example for landscape orportrait)you have to repeat the actual text (and keep it up to date whenmaking changes)* The application cannot be translated to other languages by just adding newtranslations for existing string resources.In Android Studio and Eclipse there are quickfixes to automatically extractthis hardcoded string into a resource lookup.RelativeOverlap---------------Summary: Overlapping items in RelativeLayoutPriority: 3 / 10Severity: WarningCategory: InternationalizationIf relative layout has text or button items aligned to left and right sidesthey can overlap each other due to localized text expansion unless they havemutual constraints like toEndOf/toStartOf.Bi-directional Text===================RtlCompat---------Summary: Right-to-left text compatibility issuesPriority: 6 / 10Severity: ErrorCategory: Bi-directional TextAPI 17 adds a textAlignment attribute to specify text alignment. However, ifyou are supporting older versions than API 17, you must also specify a gravityor layout_gravity attribute, since older platforms will ignore thetextAlignment attribute.RtlSymmetry-----------Summary: Padding and margin symmetryPriority: 6 / 10Severity: WarningCategory: Bi-directional TextIf you specify padding or margin on the left side of a layout, you shouldprobably also specify padding on the right side (and vice versa) forright-to-left layout symmetry.RtlHardcoded------------Summary: Using left/right instead of start/end attributesPriority: 5 / 10Severity: WarningCategory: Bi-directional TextUsing Gravity#LEFT and Gravity#RIGHT can lead to problems when a layout isrendered in locales where text flows from right to left. Use Gravity#START andGravity#END instead. Similarly, in XML gravity and layout_gravity attributes,use start rather than left.For XML attributes such as paddingLeft and layout_marginLeft, use paddingStartand layout_marginStart. NOTE: If your minSdkVersion is less than 17, youshould add both the older left/right attributes as well as the new start/rightattributes. On older platforms, where RTL is not supported and the start/rightattributes are unknown and therefore ignored, you need the older left/rightattributes. There is a separate lint check which catches that type of error.(Note: For Gravity#LEFT and Gravity#START, you can use these constants evenwhen targeting older platforms, because the start bitmask is a superset of theleft bitmask. Therefore, you can use gravity="start" rather thangravity="left|start".)RtlEnabled----------Summary: Using RTL attributes without enabling RTL supportPriority: 3 / 10Severity: WarningCategory: Bi-directional TextTo enable right-to-left support, when running on API 17 and higher, you mustset the android:supportsRtl attribute in the manifest <application> element.If you have started adding RTL attributes, but have not yet finished themigration, you can set the attribute to false to satisfy this lint check.

?

  相关解决方案