Android uses lint + Studio to troubleshoot client-side useless string,drawable,layout resources

Source: Internet
Author: User

Right-click in the project (or Analyze in the menu), in the right-click menu that appears, there is "Analyze"-"Run Inspaction by Name ...". Enter the type of check you want to perform in the pop-up search window, such as "Unused Resources". Do not need to enter all should be automatically found, the click will pop up "inspaction scope" Selection window, select the scope of inspection, general selection of the entire project or module. Under the "Inspaction scope" window can also set the file filter, select OK after the click OK to start checking. You can then remove duplicate resources based on the results of the inspection.


In addition to the manual method removal described above, if you are using studio1.4.0 and later versions, then the Gradle build system supports the automatic removal of useless resources by simply adding the following code to your gradle configuration file

Android {    ...    Buildtypes {        Release {            true            true            proguardfiles Getdefaultproguardfile (' proguard-android.txt '), ' Proguard-rules.pro '}}    }

Gradle not only removes useless resources from your application, but also removes useless resources from the libraries you reference, making your app slim and powerful.

Official Note: http://tools.android.com/tech-docs/new-build-system/resource-shrinking

Android uses lint + Studio to troubleshoot client-side useless string,drawable,layout resources

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.