Android--------Lint Optimization Tool

Source: Internet
Author: User

What is Lint

Lint is a code scanning analysis tool provided by Android Studio that can help us discover code structure/quality issues while providing some solutions, and this process does not require our handwriting test cases.

Each problem that Lint discovers has descriptive information and rank (similar to a bug found in testing), and we can easily locate the problem and resolve it at the same time as the severity.

Of course, this "severity" We can manually adjust, some of the principles of the problem cannot be violated, must be raised to error, and some individual problems can be ignored, after all, err who can have no.

Brief introduction of Lint working mode

Lint will check the source files of our Android project based on pre-configured detection criteria, identify potential bugs or areas that can be optimized, and optimize the content to include the following:

    • Correctness: not perfect coding, such as hard coding, using outdated APIs, etc.
    • Performance: Code that affects performance, such as static references, circular references, etc.
    • Internationalization: Internationalization, direct use of Chinese characters, no use of resource references, etc.
    • Security: Unsafe coding, such as allowing the use of javascriptinterface in WebView

Scope of the analysis

To perform a static analysis of an Android project, the first is to specify the range of source files to be parsed. The following areas are included:

    1. The entire project or module.
    2. directories and files.
    3. tags and annotations are used in XML and Java files to ignore checks.
    4. Lint check the results of warning and error two levels, you can ignore the warning problem.

Lint using the path:
toolbar, Analyze, Inspect Code ...

Clicking Inspect Code will pop up the check box dialog:

The default is to check the entire project, we can click Custom scope to customize the scope of the check.

Click the drop-down box on the right and the following options appear:

Each of them is:

    • Project files: all project documents
    • Project Production Files: code file for projects
    • Project Test Files: Testing file for projects
    • OpenFiles: currently open file
    • Module ' app ': the main app module
    • Current file:

Click OK to detect, show check results

Using lint for code inspection and analysis is very simple and efficient, before releasing the version, using lint to optimize the project, why not.

Android--------Lint Optimization Tool

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.