Android - 抑制lint的Android XML的警告:tools:ignore

抑制lint的Android XML的警告:tools:ignore


本文地址:http://blog.csdn.net/caroline_wendy


AndroidXML经常会出现警告,对于一个良好的程序,应该认真对待所有的警告。
除非我们可以确认警告,才可以排除。
显示所有警告的方法:Analyze -> Inspect Code; 就可以检查出所有的警告;

抑制警告使用: tools:ignore.
 // 忽略全部
[html] view plain copy
  1. xmlns:tools="http://schemas.android.com/tools"  
  2. tools:ignore=“all”  
警告含义总结:
[plain] view plain copy
  1. $ lint --show  
  2. Available issues:  
  3.   
  4. Correctness  
  5. ===========  
  6.   
  7. AdapterViewChildren  
  8. -------------------  
  9. Summary: Checks that AdapterViews do not define their children in XML  
  10.   
  11. Priority: 10 / 10  
  12. Severity: Warning  
  13. Category: Correctness  
  14.   
  15. AdapterViews such as ListViews must be configured with data from Java code,  
  16. such as a ListAdapter.  
  17.   
  18. More information: http://developer.android.com/reference/android/widget/AdapterView.html  
  19.   
  20. OnClick  
  21. -------  
  22. Summary: Ensures that onClick attribute values refer to real methods  
  23.   
  24. Priority: 10 / 10  
  25. Severity: Error  
  26. Category: Correctness  
  27.   
  28. The onClick attribute value should be the name of a method in this View's  
  29. context to invoke when the view is clicked. This name must correspond to a  
  30. public method that takes exactly one parameter of type View.  
  31.   
  32. Must be a string value, using '\;' to escape characters such as '\n' or  
  33. '\uxxxx' for a unicode character.  
  34.   
  35. SuspiciousImport  
  36. ----------------  
  37. Summary: Checks for 'import android.R' statements, which are usually  
  38. accidental  
  39.   
  40. Priority: 9 / 10  
  41. Severity: Warning  
  42. Category: Correctness  
  43.   
  44. Importing android.R is usually not intentional; it sometimes happens when you  
  45. use an IDE and ask it to automatically add imports at a time when your  
  46. project's R class it not present.  
  47.   
  48. Once the import is there you might get a lot of "confusing" error messages  
  49. because of course the fields available on android.R are not the ones you'd  
  50. expect from just looking at your own R class.  
  51.   
  52. UsesMinSdkAttributes  
  53. --------------------  
  54. Summary: Checks that the minimum SDK and target SDK attributes are defined  
  55.   
  56. Priority: 9 / 10  
  57. Severity: Warning  
  58. Category: Correctness  
  59.   
  60. The manifest should contain a <uses-sdk> element which defines the minimum  
  61. minimum API Level required for the application to run, as well as the target  
  62. version (the highest API level you have tested the version for.)  
  63.   
  64. More information: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html  
  65.   
  66. WrongViewCast  
  67. -------------  
  68. Summary: Looks for incorrect casts to views that according to the XML are of a  
  69. different type  
  70.   
  71. Priority: 9 / 10  
  72. Severity: Error  
  73. Category: Correctness  
  74.   
  75. Keeps track of the view types associated with ids and if it finds a usage of  
  76. the id in the Java code it ensures that it is treated as the same type.  
  77.   
  78. MissingRegistered  
  79. -----------------  
  80. Summary: Ensures that classes referenced in the manifest are present in the  
  81. project or libraries  
  82.   
  83. Priority: 8 / 10  
  84. Severity: Error  
  85. Category: Correctness  
  86.   
  87. If a class is referenced in the manifest, it must also exist in the project  
  88. (or in one of the libraries included by the project. This check helps uncover  
  89. typos in registration names, or attempts to rename or move classes without  
  90. updating the manifest file properly.  
  91.   
  92. More information: http://developer.android.com/guide/topics/manifest/manifest-intro.html  
  93.   
  94. NamespaceTypo  
  95. -------------  
  96. Summary: Looks for misspellings in namespace declarations  
  97.   
  98. Priority: 8 / 10  
  99. Severity: Warning  
  100. Category: Correctness  
  101.   
  102. Accidental misspellings in namespace declarations can lead to some very  
  103. obscure error messages. This check looks for potential misspellings to help  
  104. track these down.  
  105.   
  106. Proguard  
  107. --------  
  108. Summary: Looks for problems in proguard config files  
  109.   
  110. Priority: 8 / 10  
  111. Severity: Fatal  
  112. Category: Correctness  
  113.   
  114. Using -keepclasseswithmembernames in a proguard config file is not correct; it  
  115. can cause some symbols to be renamed which should not be.  
  116. Earlier versions of ADT used to create proguard.cfg files with the wrong  
  117. format. Instead of -keepclasseswithmembernames use -keepclasseswithmembers,  
  118. since the old flags also implies "allow shrinking" which means symbols only  
  119. referred to from XML and not Java (such as possibly CustomViews) can get  
  120. deleted.  
  121.   
  122. More information: http://http://code.google.com/p/android/issues/detail?id=16384  
  123.   
  124. ScrollViewCount  
  125. ---------------  
  126. Summary: Checks that ScrollViews have exactly one child widget  
  127.   
  128. Priority: 8 / 10  
  129. Severity: Warning  
  130. Category: Correctness  
  131.   
  132. ScrollViews can only have one child widget. If you want more children, wrap  
  133. them in a container layout.  
  134.   
  135. StyleCycle  
  136. ----------  
  137. Summary: Looks for cycles in style definitions  
  138.   
  139. Priority: 8 / 10  
  140. Severity: Fatal  
  141. Category: Correctness  
  142.   
  143. There should be no cycles in style definitions as this can lead to runtime  
  144. exceptions.  
  145.   
  146. More information: http://developer.android.com/guide/topics/ui/themes.html#Inheritance  
  147.   
  148. UnknownId  
  149. ---------  
  150. Summary: Checks for id references in RelativeLayouts that are not defined  
  151. elsewhere  
  152.   
  153. Priority: 8 / 10  
  154. Severity: Fatal  
  155. Category: Correctness  
  156.   
  157. The @+id/ syntax refers to an existing id, or creates a new one if it has not  
  158. already been defined elsewhere. However, this means that if you have a typo in  
  159. your reference, or if the referred view no longer exists, you do not get a  
  160. warning since the id will be created on demand. This check catches errors  
  161. where you have renamed an id without updating all of the references to it.  
  162.   
  163. WrongFolder  
  164. -----------  
  165. Summary: Finds resource files that are placed in the wrong folders  
  166.   
  167. Priority: 8 / 10  
  168. Severity: Error  
  169. Category: Correctness  
  170.   
  171. Resource files are sometimes placed in the wrong folder, and it can lead to  
  172. subtle bugs that are hard to understand. This check looks for problems in this  
  173. area, such as attempting to place a layout "alias" file in a layout/ folder  
  174. rather than the values/ folder where it belongs.  
  175.   
  176. DalvikOverride  
  177. --------------  
  178. Summary: Looks for methods treated as overrides by Dalvik  
  179.   
  180. Priority: 7 / 10  
  181. Severity: Error  
  182. Category: Correctness  
  183.   
  184. The Android virtual machine will treat a package private method in one class  
  185. as overriding a package private method in its super class, even if they are in  
  186. separate packages. This may be surprising, but for compatibility reasons the  
  187. behavior has not been changed (yet).  
  188.   
  189. If you really did intend for this method to override the other, make the  
  190. method protected instead.  
  191.   
  192. If you did not intend the override, consider making the method private, or  
  193. changing its name or signature.  
  194.   
  195. DuplicateIds  
  196. ------------  
  197. Summary: Checks for duplicate ids within a single layout  
  198.   
  199. Priority: 7 / 10  
  200. Severity: Warning  
  201. Category: Correctness  
  202.   
  203. Within a layout, id's should be unique since otherwise findViewById() can  
  204. return an unexpected view.  
  205.   
  206. InconsistentArrays  
  207. ------------------  
  208. Summary: Checks for inconsistencies in the number of elements in arrays  
  209.   
  210. Priority: 7 / 10  
  211. Severity: Warning  
  212. Category: Correctness  
  213.   
  214. When an array is translated in a different locale, it should normally have the  
  215. same number of elements as the original array. When adding or removing  
  216. elements to an array, it is easy to forget to update all the locales, and this  
  217. lint warning finds inconsistencies like these.  
  218.   
  219. Note however that there may be cases where you really want to declare a  
  220. different number of array items in each configuration (for example where the  
  221. array represents available options, and those options differ for different  
  222. layout orientations and so on), so use your own judgement to decide if this is  
  223. really an error.  
  224.   
  225. You can suppress this error type if it finds false errors in your project.  
  226.   
  227. NestedScrolling  
  228. ---------------  
  229. Summary: Checks whether a scrolling widget has any nested scrolling widgets  
  230. within  
  231.   
  232. Priority: 7 / 10  
  233. Severity: Warning  
  234. Category: Correctness  
  235.   
  236. A scrolling widget such as a ScrollView should not contain any nested  
  237. scrolling widgets since this has various usability issues  
  238.   
  239. ResourceAsColor  
  240. ---------------  
  241. Summary: Looks for calls to setColor where a resource id is passed instead of  
  242. a resolved color  
  243.   
  244. Priority: 7 / 10  
  245. Severity: Error  
  246. Category: Correctness  
  247.   
  248. Methods that take a color in the form of an integer should be passed an RGB  
  249. triple, not the actual color resource id. You must call  
  250. getResources().getColor(resource) to resolve the actual color value first.  
  251.   
  252. ScrollViewSize  
  253. --------------  
  254. Summary: Checks that ScrollViews use wrap_content in scrolling dimension  
  255.   
  256. Priority: 7 / 10  
  257. Severity: Warning  
  258. Category: Correctness  
  259.   
  260. ScrollView children must set their layout_width or layout_height attributes to  
  261. wrap_content rather than fill_parent or match_parent in the scrolling  
  262. dimension  
  263.   
  264. TextViewEdits  
  265. -------------  
  266. Summary: Looks for TextViews being used for input  
  267.   
  268. Priority: 7 / 10  
  269. Severity: Warning  
  270. Category: Correctness  
  271.   
  272. Using a <TextView> to input text is generally an error, you should be using  
  273. <EditText> instead.  EditText is a subclass of TextView, and some of the  
  274. editing support is provided by TextView, so it's possible to set some  
  275. input-related properties on a TextView. However, using a TextView along with  
  276. input attributes is usually a cut & paste error. To input text you should be  
  277. using <EditText>.  
  278. This check also checks subclasses of TextView, such as Button and CheckBox,  
  279. since these have the same issue: they should not be used with editable  
  280. attributes.  
  281.   
  282. CommitPrefEdits  
  283. ---------------  
  284. Summary: Looks for code editing a SharedPreference but forgetting to call  
  285. commit() on it  
  286.   
  287. Priority: 6 / 10  
  288. Severity: Warning  
  289. Category: Correctness  
  290.   
  291. After calling edit() on a SharedPreference, you must call commit() or apply()  
  292. on the editor to save the results.  
  293.   
  294. DefaultLocale  
  295. -------------  
  296. Summary: Finds calls to locale-ambiguous String manipulation methods  
  297.   
  298. Priority: 6 / 10  
  299. Severity: Warning  
  300. Category: Correctness  
  301.   
  302. Calling String#toLowerCase() or #toUpperCase() without specifying an explicit  
  303. locale is a common source of bugs. The reason for that is that those methods  
  304. will use the current locale on the user's device, and even though the code  
  305. appears to work correctly when you are developing the app, it will fail in  
  306. some locales. For example, in the Turkish locale, the uppercase replacement  
  307. for i is not I.  
  308.   
  309. If you want the methods to just perform ASCII replacement, for example to  
  310. convert an enum name, call String#toUpperCase(Locale.US) instead. If you  
  311. really want to use the current locale, call  
  312. String#toUpperCase(Locale.getDefault()) instead.  
  313.   
  314. More information: http://developer.android.com/reference/java/util/Locale.html#default_locale  
  315.   
  316. DuplicateIncludedIds  
  317. --------------------  
  318. Summary: Checks for duplicate ids across layouts that are combined with  
  319. include tags  
  320.   
  321. Priority: 6 / 10  
  322. Severity: Warning  
  323. Category: Correctness  
  324.   
  325. It's okay for two independent layouts to use the same ids. However, if layouts  
  326. are combined with include tags, then the id's need to be unique within any  
  327. chain of included layouts, or Activity#findViewById() can return an unexpected  
  328. view.  
  329.   
  330. Instantiatable  
  331. --------------  
  332. Summary: Ensures that classes registered in the manifest file are  
  333. instantiatable  
  334.   
  335. Priority: 6 / 10  
  336. Severity: Warning  
  337. Category: Correctness  
  338.   
  339. Activities, services, broadcast receivers etc. registered in the manifest file  
  340. must be "instiantable" by the system, which means that the class must be  
  341. public, it must have an empty public constructor, and if it's an inner class,  
  342. it must be a static inner class.  
  343.   
  344. LibraryCustomView  
  345. -----------------  
  346. Summary: Flags custom attributes in libraries, which must use the  
  347. res-auto-namespace instead  
  348.   
  349. Priority: 6 / 10  
  350. Severity: Error  
  351. Category: Correctness  
  352.   
  353. When using a custom view with custom attributes in a library project, the  
  354. layout must use the special namespace http://schemas.android.com/apk/res-auto  
  355. instead of a URI which includes the library project's own package. This will  
  356. be used to automatically adjust the namespace of the attributes when the  
  357. library resources are merged into the application project.  
  358.   
  359. MissingPrefix  
  360. -------------  
  361. Summary: Detect XML attributes not using the Android namespace  
  362.   
  363. Priority: 6 / 10  
  364. Severity: Error  
  365. Category: Correctness  
  366.   
  367. Most Android views have attributes in the Android namespace. When referencing  
  368. these attributes you must include the namespace prefix, or your attribute will  
  369. be interpreted by aapt as just a custom attribute.  
  370.   
  371. Similarly, in manifest files, nearly all attributes should be in the android:  
  372. namespace.  
  373.   
  374. MultipleUsesSdk  
  375. ---------------  
  376. Summary: Checks that the <uses-sdk> element appears at most once  
  377.   
  378. Priority: 6 / 10  
  379. Severity: Fatal  
  380. Category: Correctness  
  381.   
  382. The <uses-sdk> element should appear just once; the tools will not merge the  
  383. contents of all the elements so if you split up the atttributes across  
  384. multiple elements, only one of them will take effect. To fix this, just merge  
  385. all the attributes from the various elements into a single <uses-sdk>  
  386. element.  
  387.   
  388. More information: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html  
  389.   
  390. NewApi  
  391. ------  
  392. Summary: Finds API accesses to APIs that are not supported in all targeted API  
  393. versions  
  394.   
  395. Priority: 6 / 10  
  396. Severity: Error  
  397. Category: Correctness  
  398.   
  399. This check scans through all the Android API calls in the application and  
  400. warns about any calls that are not available on all versions targeted by this  
  401. application (according to its minimum SDK attribute in the manifest).  
  402.   
  403. If you really want to use this API and don't need to support older devices  
  404. just set the minSdkVersion in your AndroidManifest.xml file.  
  405. If your code is deliberately accessing newer APIs, and you have ensured (e.g.  
  406. with conditional execution) that this code will only ever be called on a  
  407. supported platform, then you can annotate your class or method with the  
  408. @TargetApi annotation specifying the local minimum SDK to apply, such as  
  409. @TargetApi(11), such that this check considers 11 rather than your manifest  
  410. file's minimum SDK as the required API level.  
  411.   
  412. OldTargetApi  
  413. ------------  
  414. Summary: Checks that the manifest specifies a targetSdkVersion that is recent  
  415.   
  416. Priority: 6 / 10  
  417. Severity: Warning  
  418. Category: Correctness  
  419.   
  420. When your application runs on a version of Android that is more recent than  
  421. your targetSdkVersion specifies that it has been tested with, various  
  422. compatibility modes kick in. This ensures that your application continues to  
  423. work, but it may look out of place. For example, if the targetSdkVersion is  
  424. less than 14, your app may get an option button in the UI.  
  425.   
  426. To fix this issue, set the targetSdkVersion to the highest available value.  
  427. Then test your app to make sure everything works correctly. You may want to  
  428. consult the compatibility notes to see what changes apply to each version you  
  429. are adding support for:  
  430. http://developer.android.com/reference/android/os/Build.VERSION_CODES.html  
  431.   
  432. More information: http://developer.android.com/reference/android/os/Build.VERSION_CODES.html  
  433.   
  434. Registered  
  435. ----------  
  436. Summary: Ensures that Activities, Services and Content Providers are  
  437. registered in the manifest  
  438.   
  439. Priority: 6 / 10  
  440. Severity: Warning  
  441. Category: Correctness  
  442.   
  443. Activities, services and content providers should be registered in the  
  444. AndroidManifext.xml file using <activity>, <service> and <provider> tags.  
  445.   
  446. If your activity is simply a parent class intended to be subclassed by other  
  447. "real" activities, make it an abstract class.  
  448.   
  449. More information: http://developer.android.com/guide/topics/manifest/manifest-intro.html  
  450.   
  451. SdCardPath  
  452. ----------  
  453. Summary: Looks for hardcoded references to /sdcard  
  454.   
  455. Priority: 6 / 10  
  456. Severity: Warning  
  457. Category: Correctness  
  458.   
  459. Your code should not reference the /sdcard path directly; instead use  
  460. Environment.getExternalStorageDirectory().getPath()  
  461.   
  462. More information: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal  
  463.   
  464. ShowToast  
  465. ---------  
  466. Summary: Looks for code creating a Toast but forgetting to call show() on it  
  467.   
  468. Priority: 6 / 10  
  469. Severity: Warning  
  470. Category: Correctness  
  471.   
  472. Toast.makeText() creates a Toast but does not show it. You must call show() on  
  473. the resulting object to actually make the Toast appear.  
  474.   
  475. SimpleDateFormat  
  476. ----------------  
  477. Summary: Using SimpleDateFormat directly without an explicit locale  
  478.   
  479. Priority: 6 / 10  
  480. Severity: Warning  
  481. Category: Correctness  
  482.   
  483. Almost all callers should use getDateInstance(), getDateTimeInstance(), or  
  484. getTimeInstance() to get a ready-made instance of SimpleDateFormat suitable  
  485. for the user's locale. The main reason you'd create an instance this class  
  486. directly is because you need to format/parse a specific machine-readable  
  487. format, in which case you almost certainly want to explicitly ask for US to  
  488. ensure that you get ASCII digits (rather than, say, Arabic digits).  
  489.   
  490. Therefore, you should either use the form of the SimpleDateFormat constructor  
  491. where you pass in an explicit locale, such as Locale.US, or use one of the get  
  492. instance methods, or suppress this error if really know what you are doing.  
  493.   
  494. More information: http://developer.android.com/reference/java/text/SimpleDateFormat.html  
  495.   
  496. UniquePermission  
  497. ----------------  
  498. Summary: Checks that permission names are unique  
  499.   
  500. Priority: 6 / 10  
  501. Severity: Error  
  502. Category: Correctness  
  503.   
  504. The unqualified names or your permissions must be unique. The reason for this  
  505. is that at build time, the aapt tool will generate a class named Manifest  
  506. which contains a field for each of your permissions. These fields are named  
  507. using your permission unqualified names (i.e. the name portion after the last  
  508. dot).  
  509.   
  510. If more than one permission maps to the same field name, that field will  
  511. arbitrarily name just one of them.  
  512.   
  513. ValidFragment  
  514. -------------  
  515. Summary: Ensures that Fragment subclasses can be instantiated  
  516.   
  517. Priority: 6 / 10  
  518. Severity: Warning  
  519. Category: Correctness  
  520.   
  521. From the Fragment documentation:  
  522. Every fragment must have an empty constructor, so it can be instantiated when  
  523. restoring its activity's state. It is strongly recommended that subclasses do  
  524. not have other constructors with parameters, since these constructors will not  
  525. be called when the fragment is re-instantiated; instead, arguments can be  
  526. supplied by the caller with setArguments(Bundle) and later retrieved by the  
  527. Fragment with getArguments().  
  528.   
  529. More information: http://developer.android.com/reference/android/app/Fragment.html#Fragment()  
  530.   
  531. WrongManifestParent  
  532. -------------------  
  533. Summary: Checks that various manifest elements are declared in the right  
  534. place  
  535.   
  536. Priority: 6 / 10  
  537. Severity: Fatal  
  538. Category: Correctness  
  539.   
  540. The <uses-library> element should be defined as a direct child of the  
  541. <application> tag, not the <manifest> tag or an <activity> tag. Similarly, a  
  542. <uses-sdk> tag much be declared at the root level, and so on. This check looks  
  543. for incorrect declaration locations in the manifest, and complains if an  
  544. element is found in the wrong place.  
  545.   
  546. More information: http://developer.android.com/guide/topics/manifest/manifest-intro.html  
  547.   
  548. DuplicateActivity  
  549. -----------------  
  550. Summary: Checks that an activity is registered only once in the manifest  
  551.   
  552. Priority: 5 / 10  
  553. Severity: Error  
  554. Category: Correctness  
  555.   
  556. An activity should only be registered once in the manifest. If it is  
  557. accidentally registered more than once, then subtle errors can occur, since  
  558. attribute declarations from the two elements are not merged, so you may  
  559. accidentally remove previous declarations.  
  560.   
  561. ManifestOrder  
  562. -------------  
  563. Summary: Checks for manifest problems like <uses-sdk> after the <application>  
  564. tag  
  565.   
  566. Priority: 5 / 10  
  567. Severity: Warning  
  568. Category: Correctness  
  569.   
  570. The <application> tag should appear after the elements which declare which  
  571. version you need, which features you need, which libraries you need, and so  
  572. on. In the past there have been subtle bugs (such as themes not getting  
  573. applied correctly) when the <application> tag appears before some of these  
  574. other elements, so it's best to order your manifest in the logical dependency  
  575. order.  
  576.   
  577. MissingId  
  578. ---------  
  579. Summary: Ensures that XML tags like <fragment> specify an id or tag attribute  
  580.   
  581. Priority: 5 / 10  
  582. Severity: Warning  
  583. Category: Correctness  
  584.   
  585. If you do not specify an android:id or an android:tag attribute on a  
  586. <fragment> element, then if the activity is restarted (for example for an  
  587. orientation rotation) you may lose state. From the fragment documentation:  
  588.   
  589. "Each fragment requires a unique identifier that the system can use to restore  
  590. the fragment if the activity is restarted (and which you can use to capture  
  591. the fragment to perform transactions, such as remove it). * Supply the  
  592. android:id attribute with a unique ID.  
  593. * Supply the android:tag attribute with a unique string.  
  594. If you provide neither of the previous two, the system uses the ID of the  
  595. container view.  
  596.   
  597. More information: http://developer.android.com/guide/components/fragments.html  
  598.   
  599. ProtectedPermissons  
  600. -------------------  
  601. Summary: Looks for permissions that are only granted to system apps  
  602.   
  603. Priority: 5 / 10  
  604. Severity: Error  
  605. Category: Correctness  
  606.   
  607. Permissions with the protection level signature or signatureOrSystem are only  
  608. granted to system apps. If an app is a regular non-system app, it will never  
  609. be able to use these permissions.  
  610.   
  611. StateListReachable  
  612. ------------------  
  613. Summary: Looks for unreachable states in a <selector>  
  614.   
  615. Priority: 5 / 10  
  616. Severity: Warning  
  617. Category: Correctness  
  618.   
  619. In a selector, only the last child in the state list should omit a state  
  620. qualifier. If not, all subsequent items in the list will be ignored since the  
  621. given item will match all.  
  622.   
  623. UnknownIdInLayout  
  624. -----------------  
  625. Summary: Makes sure that @+id references refer to views in the same layout  
  626.   
  627. Priority: 5 / 10  
  628. Severity: Warning  
  629. Category: Correctness  
  630.   
  631. The @+id/ syntax refers to an existing id, or creates a new one if it has not  
  632. already been defined elsewhere. However, this means that if you have a typo in  
  633. your reference, or if the referred view no longer exists, you do not get a  
  634. warning since the id will be created on demand.  
  635.   
  636. This is sometimes intentional, for example where you are referring to a view  
  637. which is provided in a different layout via an include. However, it is usually  
  638. an accident where you have a typo or you have renamed a view without updating  
  639. all the references to it.  
  640.   
  641. UnlocalizedSms  
  642. --------------  
  643. Summary: Looks for code sending text messages to unlocalized phone numbers  
  644.   
  645. Priority: 5 / 10  
  646. Severity: Warning  
  647. Category: Correctness  
  648.   
  649. SMS destination numbers must start with a country code or the application code  
  650. must ensure that the SMS is only sent when the user is in the same country as  
  651. the receiver.  
  652.   
  653. GridLayout  
  654. ----------  
  655. Summary: Checks for potential GridLayout errors like declaring rows and  
  656. columns outside the declared grid dimensions  
  657.   
  658. Priority: 4 / 10  
  659. Severity: Fatal  
  660. Category: Correctness  
  661.   
  662. Declaring a layout_row or layout_column that falls outside the declared size  
  663. of a GridLayout's rowCount or columnCount is usually an unintentional error.  
  664.   
  665. InOrMmUsage  
  666. -----------  
  667. Summary: Looks for use of the "mm" or "in" dimensions  
  668.   
  669. Priority: 4 / 10  
  670. Severity: Warning  
  671. Category: Correctness  
  672.   
  673. Avoid using mm (millimeters) or in (inches) as the unit for dimensions.  
  674.   
  675. While it should work in principle, unfortunately many devices do not report  
  676. the correct true physical density, which means that the dimension calculations  
  677. won't work correctly. You are better off using dp (and for font sizes, sp.)  
  678.   
  679. RequiredSize  
  680. ------------  
  681. Summary: Ensures that the layout_width and layout_height are specified for all  
  682. views  
  683.   
  684. Priority: 4 / 10  
  685. Severity: Error  
  686. Category: Correctness  
  687.   
  688. All views must specify an explicit layout_width and layout_height attribute.  
  689. There is a runtime check for this, so if you fail to specify a size, an  
  690. exception is thrown at runtime.  
  691.   
  692. It's possible to specify these widths via styles as well. GridLayout, as a  
  693. special case, does not require you to specify a size.  
  694.   
  695. ExtraText  
  696. ---------  
  697. Summary: Looks for extraneous text in layout files  
  698.   
  699. Priority: 3 / 10  
  700. Severity: Warning  
  701. Category: Correctness  
  702.   
  703. Layout resource files should only contain elements and attributes. Any XML  
  704. text content found in the file is likely accidental (and potentially dangerous  
  705. if the text resembles XML and the developer believes the text to be  
  706. functional)  
  707.   
  708. InnerclassSeparator  
  709. -------------------  
  710. Summary: Ensures that inner classes are referenced using '$' instead of '.' in  
  711. class names  
  712.   
  713. Priority: 3 / 10  
  714. Severity: Warning  
  715. Category: Correctness  
  716.   
  717. When you reference an inner class in a manifest file, you must use '$' instead  
  718. of '.' as the separator character, i.e. Outer$Inner instead of Outer.Inner.  
  719.   
  720. (If you get this warning for a class which is not actually an inner class,  
  721. it's because you are using uppercase characters in your package name, which is  
  722. not conventional.)  
  723.   
  724. LocalSuppress  
  725. -------------  
  726. Summary: Looks for @SuppressLint annotations in locations where it doesn't  
  727. work for class based checks  
  728.   
  729. Priority: 3 / 10  
  730. Severity: Error  
  731. Category: Correctness  
  732.   
  733. The @SuppressAnnotation is used to suppress Lint warnings in Java files.  
  734. However, while many lint checks analyzes the Java source code, where they can  
  735. find annotations on (for example) local variables, some checks are analyzing  
  736. the .class files. And in class files, annotations only appear on classes,  
  737. fields and methods. Annotations placed on local variables disappear. If you  
  738. attempt to suppress a lint error for a class-file based lint check, the  
  739. suppress annotation not work. You must move the annotation out to the  
  740. surrounding method.  
  741.   
  742. PrivateResource  
  743. ---------------  
  744. Summary: Looks for references to private resources  
  745.   
  746. Priority: 3 / 10  
  747. Severity: Fatal  
  748. Category: Correctness  
  749.   
  750. Private resources should not be referenced; the may not be present everywhere,  
  751. and even where they are they may disappear without notice.  
  752.   
  753. To fix this, copy the resource into your own project. You can find the  
  754. platform resources under $ANDROID_SK/platforms/android-$VERSION/data/res/.  
  755.   
  756. ProguardSplit  
  757. -------------  
  758. Summary: Checks for old proguard.cfg files that contain generic Android rules  
  759.   
  760. Priority: 3 / 10  
  761. Severity: Warning  
  762. Category: Correctness  
  763.   
  764. Earlier versions of the Android tools bundled a single proguard.cfg file  
  765. containing a ProGuard configuration file suitable for Android shrinking and  
  766. obfuscation. However, that version was copied into new projects, which means  
  767. that it does not continue to get updated as we improve the default ProGuard  
  768. rules for Android.  
  769.   
  770. In the new version of the tools, we have split the ProGuard configuration into  
  771. two halves:  
  772. * A simple configuration file containing only project-specific flags, in your  
  773. project  
  774. * A generic configuration file containing the recommended set of ProGuard  
  775. options for Android projects. This generic file lives in the SDK install  
  776. directory which means that it gets updated along with the tools.  
  777.   
  778. In order for this to work, the proguard.config property in the  
  779. project.properties file now refers to a path, so you can reference both the  
  780. generic file as well as your own (and any additional files too).  
  781.   
  782. To migrate your project to the new setup, create a new proguard-project.txt  
  783. file in your project containing any project specific ProGuard flags as well as  
  784. any customizations you have made, then update your project.properties file to  
  785. contain:  
  786. proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-projec  
  787. .txt  
  788.   
  789. SpUsage  
  790. -------  
  791. Summary: Looks for uses of "dp" instead of "sp" dimensions for text sizes  
  792.   
  793. Priority: 3 / 10  
  794. Severity: Warning  
  795. Category: Correctness  
  796.   
  797. When setting text sizes, you should normally use sp, or "scale-independent  
  798. pixels". This is like the dp unit, but it is also scaled by the user's font  
  799. size preference. It is recommend you use this unit when specifying font sizes,  
  800. so they will be adjusted for both the screen density and the user's  
  801. preference.  
  802.   
  803. There are cases where you might need to use dp; typically this happens when  
  804. the text is in a container with a specific dp-size. This will prevent the text  
  805. from spilling outside the container. Note however that this means that the  
  806. user's font size settings are not respected, so consider adjusting the layout  
  807. itself to be more flexible.  
  808.   
  809. More information: http://developer.android.com/training/multiscreen/screendensities.html  
  810.   
  811. Deprecated  
  812. ----------  
  813. Summary: Looks for usages of deprecated layouts, attributes, and so on.  
  814.   
  815. Priority: 2 / 10  
  816. Severity: Warning  
  817. Category: Correctness  
  818.   
  819. Deprecated views, attributes and so on are deprecated because there is a  
  820. better way to do something. Do it that new way. You've been warned.  
  821.   
  822. MangledCRLF  
  823. -----------  
  824. Summary: Checks that files with DOS line endings are consistent  
  825.   
  826. Priority: 2 / 10  
  827. Severity: Error  
  828. Category: Correctness  
  829.   
  830. On Windows, line endings are typically recorded as carriage return plus  
  831. newline: \r\n.  
  832.   
  833. This detector looks for invalid line endings with repeated carriage return  
  834. characters (without newlines). Previous versions of the ADT plugin could  
  835. accidentally introduce these into the file, and when editing the file, the  
  836. editor could produce confusing visual artifacts.  
  837.   
  838. More information: https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421  
  839.   
  840. PxUsage  
  841. -------  
  842. Summary: Looks for use of the "px" dimension  
  843.   
  844. Priority: 2 / 10  
  845. Severity: Warning  
  846. Category: Correctness  
  847.   
  848. For performance reasons and to keep the code simpler, the Android system uses  
  849. pixels as the standard unit for expressing dimension or coordinate values.  
  850. That means that the dimensions of a view are always expressed in the code  
  851. using pixels, but always based on the current screen density. For instance, if  
  852. myView.getWidth() returns 10, the view is 10 pixels wide on the current  
  853. screen, but on a device with a higher density screen, the value returned might  
  854. be 15. If you use pixel values in your application code to work with bitmaps  
  855. that are not pre-scaled for the current screen density, you might need to  
  856. scale the pixel values that you use in your code to match the un-scaled bitmap  
  857. source.  
  858.   
  859. More information: http://developer.android.com/guide/practices/screens_support.html#screen-independence  
  860.   
  861. Correctness:Messages  
  862. ====================  
  863.   
  864. StringFormatInvalid  
  865. -------------------  
  866. Summary: Checks that format strings are valid  
  867.   
  868. Priority: 9 / 10  
  869. Severity: Error  
  870. Category: Correctness:Messages  
  871.   
  872. If a string contains a '%' character, then the string may be a formatting  
  873. string which will be passed to String.format from Java code to replace each  
  874. '%' occurrence with specific values.  
  875.   
  876. This lint warning checks for two related problems:  
  877. (1) Formatting strings that are invalid, meaning that String.format will throw  
  878. exceptions at runtime when attempting to use the format string.  
  879. (2) Strings containing '%' that are not formatting strings getting passed to a  
  880. String.format call. In this case the '%' will need to be escaped as '%%'.  
  881.   
  882. NOTE: Not all Strings which look like formatting strings are intended for use  
  883. by String.format; for example, they may contain date formats intended for  
  884. android.text.format.Time#format(). Lint cannot always figure out that a String  
  885. is a date format, so you may get false warnings in those scenarios. See the  
  886. suppress help topic for information on how to suppress errors in that case.  
  887.   
  888. StringFormatMatches  
  889. -------------------  
  890. Summary: Ensures that the format used in <string> definitions is compatible  
  891. with the String.format call  
  892.   
  893. Priority: 9 / 10  
  894. Severity: Error  
  895. Category: Correctness:Messages  
  896.   
  897. This lint check ensures the following:  
  898. (1) If there are multiple translations of the format string, then all  
  899. translations use the same type for the same numbered arguments  
  900. (2) The usage of the format string in Java is consistent with the format  
  901. string, meaning that the parameter types passed to String.format matches those  
  902. in the format string.  
  903.   
  904. MissingTranslation  
  905. ------------------  
  906. Summary: Checks for incomplete translations where not all strings are  
  907. translated  
  908.   
  909. Priority: 8 / 10  
  910. Severity: Fatal  
  911. Category: Correctness:Messages  
  912.   
  913. If an application has more than one locale, then all the strings declared in  
  914. one language should also be translated in all other languages.  
  915.   
  916. If the string should not be translated, you can add the attribute  
  917. translatable="false" on the <string> element, or you can define all your  
  918. non-translatable strings in a resource file called donottranslate.xml. Or, you  
  919. can ignore the issue with a tools:ignore="MissingTranslation" attribute.  
  920.   
  921. By default this detector allows regions of a language to just provide a subset  
  922. of the strings and fall back to the standard language strings. You can require  
  923. all regions to provide a full translation by setting the environment variable  
  924. ANDROID_LINT_COMPLETE_REGIONS.  
  925.   
  926. Typos  
  927. -----  
  928. Summary: Looks for typos in messages  
  929.   
  930. Priority: 7 / 10  
  931. Severity: Warning  
  932. Category: Correctness:Messages  
  933.   
  934. This check looks through the string definitions, and if it finds any words  
  935. that look like likely misspellings, they are flagged.  
  936.   
  937. ExtraTranslation  
  938. ----------------  
  939. Summary: Checks for translations that appear to be unused (no default language  
  940. string)  
  941.   
  942. Priority: 6 / 10  
  943. Severity: Fatal  
  944. Category: Correctness:Messages  
  945.   
  946. If a string appears in a specific language translation file, but there is no  
  947. corresponding string in the default locale, then this string is probably  
  948. unused. (It's technically possible that your application is only intended to  
  949. run in a specific locale, but it's still a good idea to provide a fallback.).  
  950.   
  951. Note that these strings can lead to crashes if the string is looked up on any  
  952. locale not providing a translation, so it's important to clean them up.  
  953.   
  954. StringFormatCount  
  955. -----------------  
  956. Summary: Ensures that all format strings are used and that the same number is  
  957. defined across translations  
  958.   
  959. Priority: 5 / 10  
  960. Severity: Warning  
  961. Category: Correctness:Messages  
  962.   
  963. When a formatted string takes arguments, it usually needs to reference the  
  964. same arguments in all translations. There are cases where this is not the  
  965. case, so this issue is a warning rather than an error by default. However,  
  966. this usually happens when a language is not translated or updated correctly.  
  967.   
  968. Security  
  969. ========  
  970.   
  971. PackagedPrivateKey  
  972. ------------------  
  973. Summary: Looks for packaged private key files  
  974.   
  975. Priority: 8 / 10  
  976. Severity: Warning  
  977. Category: Security  
  978.   
  979. In general, you should not package private key files inside your app.  
  980.   
  981. GrantAllUris  
  982. ------------  
  983. Summary: Checks for <grant-uri-permission> elements where everything is  
  984. shared  
  985.   
  986. Priority: 7 / 10  
  987. Severity: Warning  
  988. Category: Security  
  989.   
  990. The <grant-uri-permission> element allows specific paths to be shared. This  
  991. detector checks for a path URL of just '/' (everything), which is probably not  
  992. what you want; you should limit access to a subset.  
  993.   
  994. SetJavaScriptEnabled  
  995. --------------------  
  996. Summary: Looks for invocations of  
  997. android.webkit.WebSettings.setJavaScriptEnabled  
  998.   
  999. Priority: 6 / 10  
  1000. Severity: Warning  
  1001. Category: Security  
  1002.   
  1003. Your code should not invoke setJavaScriptEnabled if you are not sure thatyour  
  1004. app really requires JavaScript support.  
  1005.   
  1006. More information: http://developer.android.com/guide/practices/security.html  
  1007.   
  1008. ExportedContentProvider  
  1009. -----------------------  
  1010. Summary: Checks for exported content providers that do not require  
  1011. permissions  
  1012.   
  1013. Priority: 5 / 10  
  1014. Severity: Warning  
  1015. Category: Security  
  1016.   
  1017. Content providers are exported by default and any application on the system  
  1018. can potentially use them to read and write data. If the contentprovider  
  1019. provides access to sensitive data, it should be protected by specifying  
  1020. export=false in the manifest or by protecting it with a permission that can be  
  1021. granted to other applications.  
  1022.   
  1023. ExportedReceiver  
  1024. ----------------  
  1025. Summary: Checks for exported receivers that do not require permissions  
  1026.   
  1027. Priority: 5 / 10  
  1028. Severity: Warning  
  1029. Category: Security  
  1030.   
  1031. Exported receivers (receivers which either set exported=true or contain an  
  1032. intent-filter and do not specify exported=false) should define a permission  
  1033. that an entity must have in order to launch the receiver or bind to it.  
  1034. Without this, any application can use this receiver.  
  1035.   
  1036. ExportedService  
  1037. ---------------  
  1038. Summary: Checks for exported services that do not require permissions  
  1039.   
  1040. Priority: 5 / 10  
  1041. Severity: Warning  
  1042. Category: Security  
  1043.   
  1044. Exported services (services which either set exported=true or contain an  
  1045. intent-filter and do not specify exported=false) should define a permission  
  1046. that an entity must have in order to launch the service or bind to it. Without  
  1047. this, any application can use this service.  
  1048.   
  1049. HardcodedDebugMode  
  1050. ------------------  
  1051. Summary: Checks for hardcoded values of android:debuggable in the manifest  
  1052.   
  1053. Priority: 5 / 10  
  1054. Severity: Warning  
  1055. Category: Security  
  1056.   
  1057. It's best to leave out the android:debuggable attribute from the manifest. If  
  1058. you do, then the tools will automatically insert android:debuggable=true when  
  1059. building an APK to debug on an emulator or device. And when you perform a  
  1060. release build, such as Exporting APK, it will automatically set it to false.  
  1061.   
  1062. If on the other hand you specify a specific value in the manifest file, then  
  1063. the tools will always use it. This can lead to accidentally publishing your  
  1064. app with debug information.  
  1065.   
  1066. WorldReadableFiles  
  1067. ------------------  
  1068. Summary: Checks for openFileOutput() and getSharedPreferences() calls passing  
  1069. MODE_WORLD_READABLE  
  1070.   
  1071. Priority: 4 / 10  
  1072. Severity: Warning  
  1073. Category: Security  
  1074.   
  1075. There are cases where it is appropriate for an application to write world  
  1076. readable files, but these should be reviewed carefully to ensure that they  
  1077. contain no private data that is leaked to other applications.  
  1078.   
  1079. WorldWriteableFiles  
  1080. -------------------  
  1081. Summary: Checks for openFileOutput() and getSharedPreferences() calls passing  
  1082. MODE_WORLD_WRITEABLE  
  1083.   
  1084. Priority: 4 / 10  
  1085. Severity: Warning  
  1086. Category: Security  
  1087.   
  1088. There are cases where it is appropriate for an application to write world  
  1089. writeable files, but these should be reviewed carefully to ensure that they  
  1090. contain no private data, and that if the file is modified by a malicious  
  1091. application it does not trick or compromise your application.  
  1092.   
  1093. AllowBackup  
  1094. -----------  
  1095. Summary: Ensure that allowBackup is explicitly set in the application's  
  1096. manifest  
  1097.   
  1098. Priority: 3 / 10  
  1099. Severity: Warning  
  1100. Category: Security  
  1101.   
  1102. The allowBackup attribute determines if an application's data can be backed up  
  1103. and restored. It is documented at  
  1104. http://developer.android.com/reference/android/R.attr.html#allowBackup  
  1105.   
  1106. By default, this flag is set to true. When this flag is set to true,  
  1107. application data can be backed up and restored by the user using adb backup  
  1108. and adb restore.  
  1109.   
  1110. This may have security consequences for an application. adb backup allows  
  1111. users who have enabled USB debugging to copy application data off of the  
  1112. device. Once backed up, all application data can be read by the user. adb  
  1113. restore allows creation of application data from a source specified by the  
  1114. user. Following a restore, applications should not assume that the data, file  
  1115. permissions, and directory permissions were created by the application  
  1116. itself.  
  1117.   
  1118. Setting allowBackup="false" opts an application out of both backup and  
  1119. restore.  
  1120.   
  1121. To fix this warning, decide whether your application should support backup,  
  1122. and explicitly set android:allowBackup=(true|false)"  
  1123.   
  1124. More information: http://developer.android.com/reference/android/R.attr.html#allowBackup  
  1125.   
  1126. ExportedActivity  
  1127. ----------------  
  1128. Summary: Checks for exported activities that do not require permissions  
  1129.   
  1130. Priority: 2 / 10  
  1131. Severity: Warning  
  1132. Category: Security  
  1133.   
  1134. Exported activities (activities which either set exported=true or contain an  
  1135. intent-filter and do not specify exported=false) should define a permission  
  1136. that an entity must have in order to launch the activity or bind to it.  
  1137. Without this, any application can use this activity.  
  1138.   
  1139. Performance  
  1140. ===========  
  1141.   
  1142. DrawAllocation  
  1143. --------------  
  1144. Summary: Looks for memory allocations within drawing code  
  1145.   
  1146. Priority: 9 / 10  
  1147. Severity: Warning  
  1148. Category: Performance  
  1149.   
  1150. You should avoid allocating objects during a drawing or layout operation.  
  1151. These are called frequently, so a smooth UI can be interrupted by garbage  
  1152. collection pauses caused by the object allocations.  
  1153.   
  1154. The way this is generally handled is to allocate the needed objects up front  
  1155. and to reuse them for each drawing operation.  
  1156.   
  1157. Some methods allocate memory on your behalf (such as Bitmap.create), and these  
  1158. should be handled in the same way.  
  1159.   
  1160. SecureRandom  
  1161. ------------  
  1162. Summary: Looks for suspicious usage of the SecureRandom class  
  1163.   
  1164. Priority: 9 / 10  
  1165. Severity: Warning  
  1166. Category: Performance  
  1167.   
  1168. Specifying a fixed seed will cause the instance to return a predictable  
  1169. sequence of numbers. This may be useful for testing but it is not appropriate  
  1170. for secure use.  
  1171.   
  1172. More information: http://developer.android.com/reference/java/security/SecureRandom.html  
  1173.   
  1174. Wakelock  
  1175. --------  
  1176. Summary: Looks for problems with wakelock usage  
  1177.   
  1178. Priority: 9 / 10  
  1179. Severity: Warning  
  1180. Category: Performance  
  1181.   
  1182. Failing to release a wakelock properly can keep the Android device in a high  
  1183. power mode, which reduces battery life. There are several causes of this, such  
  1184. as releasing the wake lock in onDestroy() instead of in onPause(), failing to  
  1185. call release() in all possible code paths after an acquire(), and so on.  
  1186.   
  1187. NOTE: If you are using the lock just to keep the screen on, you should  
  1188. strongly consider using FLAG_KEEP_SCREEN_ON instead. This window flag will be  
  1189. correctly managed by the platform as the user moves between applications and  
  1190. doesn't require a special permission. See  
  1191. http://developer.android.com/reference/android/view/WindowManager.LayoutParams  
  1192. html#FLAG_KEEP_SCREEN_ON.  
  1193.   
  1194. ObsoleteLayoutParam  
  1195. -------------------  
  1196. Summary: Looks for layout params that are not valid for the given parent  
  1197. layout  
  1198.   
  1199. Priority: 6 / 10  
  1200. Severity: Warning  
  1201. Category: Performance  
  1202.   
  1203. The given layout_param is not defined for the given layout, meaning it has no  
  1204. effect. This usually happens when you change the parent layout or move view  
  1205. code around without updating the layout params. This will cause useless  
  1206. attribute processing at runtime, and is misleading for others reading the  
  1207. layout so the parameter should be removed.  
  1208.   
  1209. UseCompoundDrawables  
  1210. --------------------  
  1211. Summary: Checks whether the current node can be replaced by a TextView using  
  1212. compound drawables.  
  1213.   
  1214. Priority: 6 / 10  
  1215. Severity: Warning  
  1216. Category: Performance  
  1217.   
  1218. A LinearLayout which contains an ImageView and a TextView can be more  
  1219. efficiently handled as a compound drawable (a single TextView, using the  
  1220. drawableTop, drawableLeft, drawableRight and/or drawableBottom attributes to  
  1221. draw one or more images adjacent to the text).  
  1222.   
  1223. If the two widgets are offset from each other with margins, this can be  
  1224. replaced with a drawablePadding attribute.  
  1225.   
  1226. There's a lint quickfix to perform this conversion in the Eclipse plugin.  
  1227.   
  1228. ViewTag  
  1229. -------  
  1230. Summary: Finds potential leaks when using View.setTag  
  1231.   
  1232. Priority: 6 / 10  
  1233. Severity: Warning  
  1234. Category: Performance  
  1235.   
  1236. Prior to Android 4.0, the implementation of View.setTag(int, Object) would  
  1237. store the objects in a static map, where the values were strongly referenced.  
  1238. This means that if the object contains any references pointing back to the  
  1239. context, the context (which points to pretty much everything else) will leak.  
  1240. If you pass a view, the view provides a reference to the context that created  
  1241. it. Similarly, view holders typically contain a view, and cursors are  
  1242. sometimes also associated with views.  
  1243.   
  1244. FieldGetter  
  1245. -----------  
  1246. Summary: Suggests replacing uses of getters with direct field access within a  
  1247. class  
  1248.   
  1249. Priority: 4 / 10  
  1250. Severity: Warning  
  1251. Category: Performance  
  1252. NOTE: This issue is disabled by default!  
  1253. You can enable it by adding --enable FieldGetter  
  1254.   
  1255. Accessing a field within the class that defines a getter for that field is at  
  1256. least 3 times faster than calling the getter. For simple getters that do  
  1257. nothing other than return the field, you might want to just reference the  
  1258. local field directly instead.  
  1259.   
  1260. NOTE: As of Android 2.3 (Gingerbread), this optimization is performed  
  1261. automatically by Dalvik, so there is no need to change your code; this is only  
  1262. relevant if you are targeting older versions of Android.  
  1263.   
  1264. More information: http://developer.android.com/guide/practices/design/performance.html#internal_get_set  
  1265.   
  1266. HandlerLeak  
  1267. -----------  
  1268. Summary: Ensures that Handler classes do not hold on to a reference to an  
  1269. outer class  
  1270.   
  1271. Priority: 4 / 10  
  1272. Severity: Warning  
  1273. Category: Performance  
  1274.   
  1275. In Android, Handler classes should be static or leaks might occur. Messages  
  1276. enqueued on the application thread's MessageQueue also retain their target  
  1277. Handler. If the Handler is an inner class, its outer class will be retained as  
  1278. well. To avoid leaking the outer class, declare the Handler as a static nested  
  1279. class with a WeakReference to its outer class.  
  1280.   
  1281. MergeRootFrame  
  1282. --------------  
  1283. Summary: Checks whether a root <FrameLayout> can be replaced with a <merge>  
  1284. tag  
  1285.   
  1286. Priority: 4 / 10  
  1287. Severity: Warning  
  1288. Category: Performance  
  1289.   
  1290. If a <FrameLayout> is the root of a layout and does not provide background or  
  1291. padding etc, it can often be replaced with a <merge> tag which is slightly  
  1292. more efficient. Note that this depends on context, so make sure you understand  
  1293. how the <merge> tag works before proceeding.  
  1294.   
  1295. More information: http://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-by.html  
  1296.   
  1297. UseSparseArrays  
  1298. ---------------  
  1299. Summary: Looks for opportunities to replace HashMaps with the more efficient  
  1300. SparseArray  
  1301.   
  1302. Priority: 4 / 10  
  1303. Severity: Warning  
  1304. Category: Performance  
  1305.   
  1306. For maps where the keys are of type integer, it's typically more efficient to  
  1307. use the Android SparseArray API. This check identifies scenarios where you  
  1308. might want to consider using SparseArray instead of HashMap for better  
  1309. performance.  
  1310.   
  1311. This is particularly useful when the value types are primitives like ints,  
  1312. where you can use SparseIntArray and avoid auto-boxing the values from int to  
  1313. Integer.  
  1314.   
  1315. If you need to construct a HashMap because you need to call an API outside of  
  1316. your control which requires a Map, you can suppress this warning using for  
  1317. example the @SuppressLint annotation.  
  1318.   
  1319. UseValueOf  
  1320. ----------  
  1321. Summary: Looks for usages of "new" for wrapper classes which should use  
  1322. "valueOf" instead  
  1323.   
  1324. Priority: 4 / 10  
  1325. Severity: Warning  
  1326. Category: Performance  
  1327.   
  1328. You should not call the constructor for wrapper classes directly, such as`new  
  1329. Integer(42)`. Instead, call the valueOf factory method, such as  
  1330. Integer.valueOf(42). This will typically use less memory because common  
  1331. integers such as 0 and 1 will share a single instance.  
  1332.   
  1333. DisableBaselineAlignment  
  1334. ------------------------  
  1335. Summary: Looks for LinearLayouts which should set  
  1336. android:baselineAligned=false  
  1337.   
  1338. Priority: 3 / 10  
  1339. Severity: Warning  
  1340. Category: Performance  
  1341.   
  1342. When a LinearLayout is used to distribute the space proportionally between  
  1343. nested layouts, the baseline alignment property should be turned off to make  
  1344. the layout computation faster.  
  1345.   
  1346. FloatMath  
  1347. ---------  
  1348. Summary: Suggests replacing android.util.FloatMath calls with java.lang.Math  
  1349.   
  1350. Priority: 3 / 10  
  1351. Severity: Warning  
  1352. Category: Performance  
  1353.   
  1354. In older versions of Android, using android.util.FloatMath was recommended for  
  1355. performance reasons when operating on floats. However, on modern hardware  
  1356. doubles are just as fast as float (though they take more memory), and in  
  1357. recent versions of Android, FloatMath is actually slower than using  
  1358. java.lang.Math due to the way the JIT optimizes java.lang.Math. Therefore, you  
  1359. should use Math instead of FloatMath if you are only targeting Froyo and  
  1360. above.  
  1361.   
  1362. More information: http://developer.android.com/guide/practices/design/performance.html#avoidfloat  
  1363.   
  1364. InefficientWeight  
  1365. -----------------  
  1366. Summary: Looks for inefficient weight declarations in LinearLayouts  
  1367.   
  1368. Priority: 3 / 10  
  1369. Severity: Warning  
  1370. Category: Performance  
  1371.   
  1372. When only a single widget in a LinearLayout defines a weight, it is more  
  1373. efficient to assign a width/height of 0dp to it since it will absorb all the  
  1374. remaining space anyway. With a declared width/height of 0dp it does not have  
  1375. to measure its own size first.  
  1376.   
  1377. NestedWeights  
  1378. -------------  
  1379. Summary: Looks for nested layout weights, which are costly  
  1380.   
  1381. Priority: 3 / 10  
  1382. Severity: Warning  
  1383. Category: Performance  
  1384.   
  1385. Layout weights require a widget to be measured twice. When a LinearLayout with  
  1386. non-zero weights is nested inside another LinearLayout with non-zero weights,  
  1387. then the number of measurements increase exponentially.  
  1388.   
  1389. Overdraw  
  1390. --------  
  1391. Summary: Looks for overdraw issues (where a view is painted only to be fully  
  1392. painted over)  
  1393.   
  1394. Priority: 3 / 10  
  1395. Severity: Warning  
  1396. Category: Performance  
  1397.   
  1398. If you set a background drawable on a root view, then you should use a custom  
  1399. theme where the theme background is null. Otherwise, the theme background will  
  1400. be painted first, only to have your custom background completely cover it;  
  1401. this is called "overdraw".  
  1402.   
  1403. NOTE: This detector relies on figuring out which layouts are associated with  
  1404. which activities based on scanning the Java code, and it's currently doing  
  1405. that using an inexact pattern matching algorithm. Therefore, it can  
  1406. incorrectly conclude which activity the layout is associated with and then  
  1407. wrongly complain that a background-theme is hidden.  
  1408.   
  1409. If you want your custom background on multiple pages, then you should consider  
  1410. making a custom theme with your custom background and just using that theme  
  1411. instead of a root element background.  
  1412.   
  1413. Of course it's possible that your custom drawable is translucent and you want  
  1414. it to be mixed with the background. However, you will get better performance  
  1415. if you pre-mix the background with your drawable and use that resulting image  
  1416. or color as a custom theme background instead.  
  1417.   
  1418. UnusedResources  
  1419. ---------------  
  1420. Summary: Looks for unused resources  
  1421.   
  1422. Priority: 3 / 10  
  1423. Severity: Warning  
  1424. Category: Performance  
  1425.   
  1426. Unused resources make applications larger and slow down builds.  
  1427.   
  1428. UselessLeaf  
  1429. -----------  
  1430. Summary: Checks whether a leaf layout can be removed.  
  1431.   
  1432. Priority: 2 / 10  
  1433. Severity: Warning  
  1434. Category: Performance  
  1435.   
  1436. A layout that has no children or no background can often be removed (since it  
  1437. is invisible) for a flatter and more efficient layout hierarchy.  
  1438.   
  1439. UselessParent  
  1440. -------------  
  1441. Summary: Checks whether a parent layout can be removed.  
  1442.   
  1443. Priority: 2 / 10  
  1444. Severity: Warning  
  1445. Category: Performance  
  1446.   
  1447. A layout with children that has no siblings, is not a scrollview or a root  
  1448. layout, and does not have a background, can be removed and have its children  
  1449. moved directly into the parent for a flatter and more efficient layout  
  1450. hierarchy.  
  1451.   
  1452. TooDeepLayout  
  1453. -------------  
  1454. Summary: Checks whether a layout hierarchy is too deep  
  1455.   
  1456. Priority: 1 / 10  
  1457. Severity: Warning  
  1458. Category: Performance  
  1459.   
  1460. Layouts with too much nesting is bad for performance. Consider using a flatter  
  1461. layout (such as RelativeLayout or GridLayout).The default maximum depth is 10  
  1462. but can be configured with the environment variable ANDROID_LINT_MAX_DEPTH.  
  1463.   
  1464. TooManyViews  
  1465. ------------  
  1466. Summary: Checks whether a layout has too many views  
  1467.   
  1468. Priority: 1 / 10  
  1469. Severity: Warning  
  1470. Category: Performance  
  1471.   
  1472. Using too many views in a single layout in a layout is bad for performance.  
  1473. Consider using compound drawables or other tricks for reducing the number of  
  1474. views in this layout.  
  1475.   
  1476. The maximum view count defaults to 80 but can be configured with the  
  1477. environment variable ANDROID_LINT_MAX_VIEW_COUNT.  
  1478.   
  1479. UnusedIds  
  1480. ---------  
  1481. Summary: Looks for unused id's  
  1482.   
  1483. Priority: 1 / 10  
  1484. Severity: Warning  
  1485. Category: Performance  
  1486. NOTE: This issue is disabled by default!  
  1487. You can enable it by adding --enable UnusedIds  
  1488.   
  1489. This resource id definition appears not to be needed since it is not  
  1490. referenced from anywhere. Having id definitions, even if unused, is not  
  1491. necessarily a bad idea since they make working on layouts and menus easier, so  
  1492. there is not a strong reason to delete these.  
  1493.   
  1494. UnusedNamespace  
  1495. ---------------  
  1496. Summary: Finds unused namespaces in XML documents  
  1497.   
  1498. Priority: 1 / 10  
  1499. Severity: Warning  
  1500. Category: Performance  
  1501.   
  1502. Unused namespace declarations take up space and require processing that is not  
  1503. necessary  
  1504.   
  1505. Usability:Typography  
  1506. ====================  
  1507.   
  1508. TypographyDashes  
  1509. ----------------  
  1510. Summary: Looks for usages of hyphens which can be replaced by n dash and m  
  1511. dash characters  
  1512.   
  1513. Priority: 5 / 10  
  1514. Severity: Warning  
  1515. Category: Usability:Typography  
  1516.   
  1517. The "n dash" (–, –) and the "m dash" (—, —) characters are used  
  1518. for ranges (n dash) and breaks (m dash). Using these instead of plain hyphens  
  1519. can make text easier to read and your application will look more polished.  
  1520.   
  1521. More information: http://en.wikipedia.org/wiki/Dash  
  1522.   
  1523. TypographyEllipsis  
  1524. ------------------  
  1525. Summary: Looks for ellipsis strings (...) which can be replaced with an  
  1526. ellipsis character  
  1527.   
  1528. Priority: 5 / 10  
  1529. Severity: Warning  
  1530. Category: Usability:Typography  
  1531.   
  1532. You can replace the string "..." with a dedicated ellipsis character, ellipsis  
  1533. character (…, …). This can help make the text more readable.  
  1534.   
  1535. More information: http://en.wikipedia.org/wiki/Ellipsis  
  1536.   
  1537. TypographyFractions  
  1538. -------------------  
  1539. Summary: Looks for fraction strings which can be replaced with a fraction  
  1540. character  
  1541.   
  1542. Priority: 5 / 10  
  1543. Severity: Warning  
  1544. Category: Usability:Typography  
  1545.   
  1546. You can replace certain strings, such as 1/2, and 1/4, with dedicated  
  1547. characters for these, such as ? (½) and BC (¼). This can help make  
  1548. the text more readable.  
  1549.   
  1550. More information: http://en.wikipedia.org/wiki/Number_Forms  
  1551.   
  1552. TypographyQuotes  
  1553. ----------------  
  1554. Summary: Looks for straight quotes which can be replaced by curvy quotes  
  1555.   
  1556. Priority: 5 / 10  
  1557. Severity: Warning  
  1558. Category: Usability:Typography  
  1559. NOTE: This issue is disabled by default!  
  1560. You can enable it by adding --enable TypographyQuotes  
  1561.   
  1562. Straight single quotes and double quotes, when used as a pair, can be replaced  
  1563. by "curvy quotes" (or directional quotes). This can make the text more  
  1564. readable.  
  1565.   
  1566. Note that you should never use grave accents and apostrophes to quote, `like  
  1567. this'.  
  1568.   
  1569. (Also note that you should not use curvy quotes for code fragments.)  
  1570.   
  1571. More information: http://en.wikipedia.org/wiki/Quotation_mark  
  1572.   
  1573. TypographyOther  
  1574. ---------------  
  1575. Summary: Looks for miscellaneous typographical problems like replacing (c)  
  1576. with ©  
  1577.   
  1578. Priority: 3 / 10  
  1579. Severity: Warning  
  1580. Category: Usability:Typography  
  1581.   
  1582. This check looks for miscellaneous typographical problems and offers  
  1583. replacement sequences that will make the text easier to read and your  
  1584. application more polished.  
  1585.   
  1586. Usability:Icons  
  1587. ===============  
  1588.   
  1589. IconNoDpi  
  1590. ---------  
  1591. Summary: Finds icons that appear in both a -nodpi folder and a dpi folder  
  1592.   
  1593. Priority: 7 / 10  
  1594. Severity: Warning  
  1595. Category: Usability:Icons  
  1596.   
  1597. Bitmaps that appear in drawable-nodpi folders will not be scaled by the  
  1598. Android framework. If a drawable resource of the same name appears both in a  
  1599. -nodpi folder as well as a dpi folder such as drawable-hdpi, then the behavior  
  1600. is ambiguous and probably not intentional. Delete one or the other, or use  
  1601. different names for the icons.  
  1602.   
  1603. IconColors  
  1604. ----------  
  1605. Summary: Checks that icons follow the recommended visual style  
  1606.   
  1607. Priority: 6 / 10  
  1608. Severity: Warning  
  1609. Category: Usability:Icons  
  1610.   
  1611. Notification icons and Action Bar icons should only white and shades of gray.  
  1612. See the Android Design Guide for more details. Note that the way Lint decides  
  1613. whether an icon is an action bar icon or a notification icon is based on the  
  1614. filename prefix: ic_menu_ for action bar icons, ic_stat_ for notification  
  1615. icons etc. These correspond to the naming conventions documented in  
  1616. http://developer.android.com/guide/practices/ui_guidelines/icon_design.html  
  1617.   
  1618. More information: http://developer.android.com/design/style/iconography.html  
  1619.   
  1620. GifUsage  
  1621. --------  
  1622. Summary: Checks for images using the GIF file format which is discouraged  
  1623.   
  1624. Priority: 5 / 10  
  1625. Severity: Warning  
  1626. Category: Usability:Icons  
  1627.   
  1628. The .gif file format is discouraged. Consider using .png (preferred) or .jpg  
  1629. (acceptable) instead.  
  1630.   
  1631. More information: http://developer.android.com/guide/topics/resources/drawable-resource.html#Bitmap  
  1632.   
  1633. IconDipSize  
  1634. -----------  
  1635. Summary: Ensures that icons across densities provide roughly the same  
  1636. density-independent size  
  1637.   
  1638. Priority: 5 / 10  
  1639. Severity: Warning  
  1640. Category: Usability:Icons  
  1641.   
  1642. Checks the all icons which are provided in multiple densities, all compute to  
  1643. roughly the same density-independent pixel (dip) size. This catches errors  
  1644. where images are either placed in the wrong folder, or icons are changed to  
  1645. new sizes but some folders are forgotten.  
  1646.   
  1647. IconDuplicatesConfig  
  1648. --------------------  
  1649. Summary: Finds icons that have identical bitmaps across various configuration  
  1650. parameters  
  1651.   
  1652. Priority: 5 / 10  
  1653. Severity: Warning  
  1654. Category: Usability:Icons  
  1655.   
  1656. If an icon is provided under different configuration parameters such as  
  1657. drawable-hdpi or -v11, they should typically be different. This detector  
  1658. catches cases where the same icon is provided in different configuration  
  1659. folder which is usually not intentional.  
  1660.   
  1661. IconExpectedSize  
  1662. ----------------  
  1663. Summary: Ensures that launcher icons, notification icons etc have the correct  
  1664. size  
  1665.   
  1666. Priority: 5 / 10  
  1667. Severity: Warning  
  1668. Category: Usability:Icons  
  1669. NOTE: This issue is disabled by default!  
  1670. You can enable it by adding --enable IconExpectedSize  
  1671.   
  1672. There are predefined sizes (for each density) for launcher icons. You should  
  1673. follow these conventions to make sure your icons fit in with the overall look  
  1674. of the platform.  
  1675.   
  1676. More information: http://developer.android.com/design/style/iconography.html  
  1677.   
  1678. IconLocation  
  1679. ------------  
  1680. Summary: Ensures that images are not defined in the density-independent  
  1681. drawable folder  
  1682.   
  1683. Priority: 5 / 10  
  1684. Severity: Warning  
  1685. Category: Usability:Icons  
  1686.   
  1687. The res/drawable folder is intended for density-independent graphics such as  
  1688. shapes defined in XML. For bitmaps, move it to drawable-mdpi and consider  
  1689. providing higher and lower resolution versions in drawable-ldpi, drawable-hdpi  
  1690. and drawable-xhdpi. If the icon really is density independent (for example a  
  1691. solid color) you can place it in drawable-nodpi.  
  1692.   
  1693. More information: http://developer.android.com/guide/practices/screens_support.html  
  1694.   
  1695. IconDensities  
  1696. -------------  
  1697. Summary: Ensures that icons provide custom versions for all supported  
  1698. densities  
  1699.   
  1700. Priority: 4 / 10  
  1701. Severity: Warning  
  1702. Category: Usability:Icons  
  1703.   
  1704. Icons will look best if a custom version is provided for each of the major  
  1705. screen density classes (low, medium, high, extra high). This lint check  
  1706. identifies icons which do not have complete coverage across the densities.  
  1707.   
  1708. Low density is not really used much anymore, so this check ignores the ldpi  
  1709. density. To force lint to include it, set the environment variable  
  1710. ANDROID_LINT_INCLUDE_LDPI=true. For more information on current density usage,  
  1711. see http://developer.android.com/resources/dashboard/screens.html  
  1712.   
  1713. More information: http://developer.android.com/guide/practices/screens_support.html  
  1714.   
  1715. IconDuplicates  
  1716. --------------  
  1717. Summary: Finds duplicated icons under different names  
  1718.   
  1719. Priority: 3 / 10  
  1720. Severity: Warning  
  1721. Category: Usability:Icons  
  1722.   
  1723. If an icon is repeated under different names, you can consolidate and just use  
  1724. one of the icons and delete the others to make your application smaller.  
  1725. However, duplicated icons usually are not intentional and can sometimes point  
  1726. to icons that were accidentally overwritten or accidentally not updated.  
  1727.   
  1728. IconExtension  
  1729. -------------  
  1730. Summary: Checks that the icon file extension matches the actual image format  
  1731. in the file  
  1732.   
  1733. Priority: 3 / 10  
  1734. Severity: Warning  
  1735. Category: Usability:Icons  
  1736.   
  1737. Ensures that icons have the correct file extension (e.g. a .png file is really  
  1738. in the PNG format and not for example a GIF file named .png.)  
  1739.   
  1740. IconMissingDensityFolder  
  1741. ------------------------  
  1742. Summary: Ensures that all the density folders are present  
  1743.   
  1744. Priority: 3 / 10  
  1745. Severity: Warning  
  1746. Category: Usability:Icons  
  1747.   
  1748. Icons will look best if a custom version is provided for each of the major  
  1749. screen density classes (low, medium, high, extra high). This lint check  
  1750. identifies folders which are missing, such as drawable-hdpi.  
  1751. Low density is not really used much anymore, so this check ignores the ldpi  
  1752. density. To force lint to include it, set the environment variable  
  1753. ANDROID_LINT_INCLUDE_LDPI=true. For more information on current density usage,  
  1754. see http://developer.android.com/resources/dashboard/screens.html  
  1755.   
  1756. More information: http://developer.android.com/guide/practices/screens_support.html  
  1757.   
  1758. Usability  
  1759. =========  
  1760.   
  1761. ButtonOrder  
  1762. -----------  
  1763. Summary: Ensures the dismissive action of a dialog is on the left and  
  1764. affirmative on the right  
  1765.   
  1766. Priority: 8 / 10  
  1767. Severity: Warning  
  1768. Category: Usability  
  1769.   
  1770. According to the Android Design Guide,  
  1771.   
  1772. "Action buttons are typically Cancel and/or OK, with OK indicating the  
  1773. preferred or most likely action. However, if the options consist of specific  
  1774. actions such as Close or Wait rather than a confirmation or cancellation of  
  1775. the action described in the content, then all the buttons should be active  
  1776. verbs. As a rule, the dismissive action of a dialog is always on the left  
  1777. whereas the affirmative actions are on the right."  
  1778.   
  1779. This check looks for button bars and buttons which look like cancel buttons,  
  1780. and makes sure that these are on the left.  
  1781.   
  1782. More information: http://developer.android.com/design/building-blocks/dialogs.html  
  1783.   
  1784. BackButton  
  1785. ----------  
  1786. Summary: Looks for Back buttons, which are not common on the Android  
  1787. platform.  
  1788.   
  1789. Priority: 6 / 10  
  1790. Severity: Warning  
  1791. Category: Usability  
  1792. NOTE: This issue is disabled by default!  
  1793. You can enable it by adding --enable BackButton  
  1794.   
  1795. According to the Android Design Guide,  
  1796.   
  1797. "Other platforms use an explicit back button with label to allow the user to  
  1798. navigate up the application's hierarchy. Instead, Android uses the main action  
  1799. bar's app icon for hierarchical navigation and the navigation bar's back  
  1800. button for temporal navigation."  
  1801. This check is not very sophisticated (it just looks for buttons with the label  
  1802. "Back"), so it is disabled by default to not trigger on common scenarios like  
  1803. pairs of Back/Next buttons to paginate through screens.  
  1804.   
  1805. More information: http://developer.android.com/design/patterns/pure-android.html  
  1806.   
  1807. MenuTitle  
  1808. ---------  
  1809. Summary: Ensures that all menu items supply a title  
  1810.   
  1811. Priority: 5 / 10  
  1812. Severity: Warning  
  1813. Category: Usability  
  1814.   
  1815. From the action bar documentation:  
  1816. "It's important that you always define android:title for each menu item — even  
  1817. if you don't declare that the title appear with the action item — for three  
  1818. reasons:  
  1819.   
  1820. * If there's not enough room in the action bar for the action item, the menu  
  1821. item appears in the overflow menu and only the title appears.  
  1822. * Screen readers for sight-impaired users read the menu item's title.  
  1823. * If the action item appears with only the icon, a user can long-press the  
  1824. item to reveal a tool-tip that displays the action item's title.  
  1825. The android:icon is always optional, but recommended.  
  1826.   
  1827. More information: http://developer.android.com/guide/topics/ui/actionbar.html  
  1828.   
  1829. TextFields  
  1830. ----------  
  1831. Summary: Looks for text fields missing inputType or hint settings  
  1832.   
  1833. Priority: 5 / 10  
  1834. Severity: Warning  
  1835. Category: Usability  
  1836.   
  1837. Providing an inputType attribute on a text field improves usability because  
  1838. depending on the data to be input, optimized keyboards can be shown to the  
  1839. user (such as just digits and parentheses for a phone number). Similarly,a  
  1840. hint attribute displays a hint to the user for what is expected in the text  
  1841. field.  
  1842.   
  1843. The lint detector also looks at the id of the view, and if the id offers a  
  1844. hint of the purpose of the field (for example, the id contains the phrase  
  1845. phone or email), then lint will also ensure that the inputType contains the  
  1846. corresponding type attributes.  
  1847.   
  1848. If you really want to keep the text field generic, you can suppress this  
  1849. warning by setting inputType="text".  
  1850.   
  1851. AlwaysShowAction  
  1852. ----------------  
  1853. Summary: Checks for uses of showAsAction="always" and suggests  
  1854. showAsAction="ifRoom" instead  
  1855.   
  1856. Priority: 3 / 10  
  1857. Severity: Warning  
  1858. Category: Usability  
  1859.   
  1860. Using showAsAction="always" in menu XML, or MenuItem.SHOW_AS_ACTION_ALWAYS in  
  1861. Java code is usually a deviation from the user interface style guide.Use  
  1862. ifRoom or the corresponding MenuItem.SHOW_AS_ACTION_IF_ROOM instead.  
  1863.   
  1864. If always is used sparingly there are usually no problems and behavior is  
  1865. roughly equivalent to ifRoom but with preference over other ifRoom items.  
  1866. Using it more than twice in the same menu is a bad idea.  
  1867.   
  1868. This check looks for menu XML files that contain more than two always actions,  
  1869. or some always actions and no ifRoom actions. In Java code, it looks for  
  1870. projects that contain references to MenuItem.SHOW_AS_ACTION_ALWAYS and no  
  1871. references to MenuItem.SHOW_AS_ACTION_IF_ROOM.  
  1872.   
  1873. More information: http://developer.android.com/design/patterns/actionbar.html  
  1874.   
  1875. ViewConstructor  
  1876. ---------------  
  1877. Summary: Checks that custom views define the expected constructors  
  1878.   
  1879. Priority: 3 / 10  
  1880. Severity: Warning  
  1881. Category: Usability  
  1882.   
  1883. Some layout tools (such as the Android layout editor for Eclipse) needs to  
  1884. find a constructor with one of the following signatures:  
  1885. * View(Context context)  
  1886. * View(Context context, AttributeSet attrs)  
  1887. * View(Context context, AttributeSet attrs, int defStyle)  
  1888.   
  1889. If your custom view needs to perform initialization which does not apply when  
  1890. used in a layout editor, you can surround the given code with a check to see  
  1891. if View#isInEditMode() is false, since that method will return false at  
  1892. runtime but true within a user interface editor.  
  1893.   
  1894. ButtonCase  
  1895. ----------  
  1896. Summary: Ensures that Cancel/OK dialog buttons use the canonical  
  1897. capitalization  
  1898.   
  1899. Priority: 2 / 10  
  1900. Severity: Warning  
  1901. Category: Usability  
  1902.   
  1903. The standard capitalization for OK/Cancel dialogs is "OK" and "Cancel". To  
  1904. ensure that your dialogs use the standard strings, you can use the resource  
  1905. strings @android:string/ok and @android:string/cancel.  
  1906.   
  1907. Accessibility  
  1908. =============  
  1909.   
  1910. ContentDescription  
  1911. ------------------  
  1912. Summary: Ensures that image widgets provide a contentDescription  
  1913.   
  1914. Priority: 3 / 10  
  1915. Severity: Warning  
  1916. Category: Accessibility  
  1917.   
  1918. Non-textual widgets like ImageViews and ImageButtons should use the  
  1919. contentDescription attribute to specify a textual description of the widget  
  1920. such that screen readers and other accessibility tools can adequately describe  
  1921. the user interface.  
  1922.   
  1923. LabelFor  
  1924. --------  
  1925. Summary: Ensures that text fields are marked with a labelFor attribute  
  1926.   
  1927. Priority: 2 / 10  
  1928. Severity: Warning  
  1929. Category: Accessibility  
  1930.   
  1931. Text fields should be labelled with a labelFor attribute, provided your  
  1932. minSdkVersion is at least 17.  
  1933.   
  1934. If your view is labeled but by a label in a different layout which includes  
  1935. this one, just suppress this warning from lint.  
  1936.   
  1937. Internationalization  
  1938. ====================  
  1939.   
  1940. HardcodedText  
  1941. -------------  
  1942. Summary: Looks for hardcoded text attributes which should be converted to  
  1943. resource lookup  
  1944.   
  1945. Priority: 5 / 10  
  1946. Severity: Warning  
  1947. Category: Internationalization  
  1948.   
  1949. Hardcoding text attributes directly in layout files is bad for several  
  1950. reasons:  
  1951.   
  1952. * When creating configuration variations (for example for landscape or  
  1953. portrait)you have to repeat the actual text (and keep it up to date when  
  1954. making changes)  
  1955.   
  1956. * The application cannot be translated to other languages by just adding new  
  1957. translations for existing string resources.  
  1958.   
  1959. EnforceUTF8  
  1960. -----------  
  1961. Summary: Checks that all XML resource files are using UTF-8 as the file  
  1962. encoding  
  1963.   
  1964. Priority: 2 / 10  
  1965. Severity: Warning  
  1966. Category: Internationalization  
  1967.   
  1968. XML supports encoding in a wide variety of character sets. However, not all  
  1969. tools handle the XML encoding attribute correctly, and nearly all Android apps  
  1970. use UTF-8, so by using UTF-8 you can protect yourself against subtle bugs when  
  1971. using non-ASCII characters.  



警告的类型可以通过文档进行查找:

具体参考:


Android - 抑制lint的Android XML的警告:tools:ignore