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'