Android Lint classification and Common Errors

Source: Internet
Author: User

Common types:
1. Correctness: Messeges
(1) The string is not completely internationalized.
(2) The International string is not defined in the default location (default locale ).
 
Ii. Correctness
(1) Duplicate view IDs in Xml
(2) Some APIs used in the Code are higher than the Min SDK in Manifest
(3) In String internationalization, the item values corresponding to the String-Array with the same name are different (4) Activity is not registered with Manifest
(5) use obsolete APIs
(6) Avoid using px and use dp
(7) add unnecessary Permissions
 
Iii. Performance
(1) avoid assigning objects when drawing or parsing the layout (draw/layout. For example, instantiate Paint () in Ondraw ().
(2) useless parameters in Layout.
(3) optimizable layout: for example, a linear layout (an Imageview and a TextView) can be replaced by TextView and a Compound Drawable.
(4) optimizable code: for example, SparseArray can replace a Hashmap of Interger2Object.
(5) Optimize layout. For example, if the Sub-view is wrap_content, set android: baselineAligned to false, then When set to false, prevents the layout from aligning its children's baselines.
(6) Use FloatMath instead of Math and execute sin () and ceil () to avoid the two conversions of float.
(7) Nested weight (both inside and outside) will drag down the execution Effect
(8) unused resources
(9) Overdraw means that the activity with the specified theme will draw its own background, but the background will be set again in the layout.
(10) View or view's father is useless
 
Iv. Security
(1) Setting setJavascriptEnable will cause a script Attack Vulnerability (XSS vulnerabilities)
 
V. Usability: Icons
(1) The image size cannot be divisible when converted to different dpi, for example, 2 * 24px
(2) Some resources with different base and browser names are displayed, but the image content is identical.
 
6. Usability
(1) The default constructor is missing for the custom view.
 
VII. Usability: Typography
(1) special characters must be replaced by encoding. For example, "_" must be replaced by "& #8211 ;"
 
Accessibility
(1) The Image view lacks src content.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.