Android Studio project slimming, code check, and androidstudio

Source: Internet
Author: User

Android Studio project slimming, code check, and androidstudio

Project slimming,

 

1. delete unused resources (images, strings, etc)

First, let's look at how to find the resources that are not used. Note: comments are also useless.

1. Perform code analysis

2. View analysis results

 

3. Select Unused resources (Unused resources)

 

4. Delete the corresponding resource. Note that comments are useless. For example, if you comment out a line of code that uses an image, the image resource is useless.

 

2. Delete packages not referenced in the class

This gray font is useless. There will be many projects that need to be deleted.

The code check is the same as above:

Click "Unused import (96 items)" here to view the referenced packages not used in each class. just delete the corresponding code.

 

3. Change 'Global variable 'to 'local variable'

Android Studio recommends that you change some 'Global variable' to 'local variable'

Note: It is only recommended that if you use it once in a method, change it to 'local variable'

If a method may be called multiple times, it depends on whether the 'Global variable 'or 'local variable' is used'

 

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.