Lint Usage Summary of Android performance optimization

Source: Internet
Author: User


to be honest, pay attention to lint. The lint tool is often helpful for memory optimization, performance optimization, code specification, etc. in Android application development. After the development of each module, lint, there is an unexpected harvest.
Introduction:Static code analysis tools, no need to run, no test casesScan the entire project to analyze the following potential issues, which are categorized to indicate problem description, problem location, and provide reasonable suggestions for modification(This is the key ah, regardless of the wood has a big problem, look at these problems and descriptions, can also be addicted to AH): ====================================Correctness CorrectnessSecurity performance Performance Usability availability accessibility Accessibility internationalization internationalization =================================== =

1) Performance

Layout Performance (formerly Layoutopt tool, can solve useless layouts, too many nesting, too many layouts, overdraw)

Other performance (e.g., Declaration of objects at Draw/layout)

2) unused resources, lack of resources (adaptation of different resources)

3) Replacement of resources with higher performance----eg:sparsebooleanarray sparseintarray

4) Internationalization issues (hard coding)

5) Icon problem (duplicate icon, wrong size)

6) Usability issues (such as input type for non-specified text fields)

7) Error in manifest file--unregistered activity service, etc.

8) memory leaks---such as: improper use of handle.

9) The memory resources timely recovery---such as:Typedarray not recycled resources, etc.

======================================

Common commands:Lint command is located below sdk/tools/, under Tools directory, or configure SDK environment variables (configuration method: http://blog.csdn.net/rflyee/article/details/8973529)LintProject# Scan for specified itemsLint--checkcorrectness--htmlreport.html  Project# Scan specified items and generate reports in HTML formatLint--help #查看帮助
How to use:1. Command. As mentioned above 2. Eclipse(1) Right button--  Android Tools > Run lint:check for Common Errors.
(2) Window > Show View > Other > Android > Lint Warnings
Configuration
partial Disable mode: 1. XML Tools:ignore Note:namespacexmlns:Tools="Http://schemas.android.com/tools"
Tools:ignore= "Unusedresources"
Tools:ignore= "Newapi,stringformatinvalid"
Tools:ignore= "All"

2. java@SuppressLint 
@SuppressLint ("Newapi")
@SuppressLint ("All")

Related documents:Official Introduction:
Http://developer.android.com/tools/help/lint.html

Lint Usage Summary of Android performance optimization

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.