Lint can be used to check and remove unwanted resource files in Android Studio.

Take a look

Methods a

1. Choose your project

2. Click the Analyze menu button on AS and select Run Inspection by Name AS shown below

3, a popover will appear, enter unused resources

4. The “InspAction Scope” selection window will pop up to select the scope of inspection, usually the whole project or module. Under the “InspAction Scope” window, you can also set the file filtering, and click OK to start checking

5, the output column below will output the unused resource file.

6, click in to see, and then delete useless.

Method 2

If you are using Studio1.4.0 or later, the Gradle build system supports automatic removal of unwanted resources. Just add the following code to your Gradle configuration file

android {

...

buildTypes {

release {

    minifyEnabled true

    shrinkResources true

}

}

Copy the code

Gradle will not only remove useless resources from your APP, but also from the libraries you refer to, making your APP slim quickly.

Android Studio uses Lint to check for and remove unwanted resource file encroachment