"Code Cleanup..." feature of Android Studio v2.2.2

Priyank Patel picture Priyank Patel · Dec 8, 2016 · Viewed 12.2k times · Source

In Android Studio v2.2.2, Code Cleanup feature available under Analyze option.

Analyze >> Code Cleanup 

What this option exactly do with code ?

Please explain in details.

Answer

AndiGeeky picture AndiGeeky · Dec 8, 2016

When you clean up your code using 'Android Studio', It start inspecting code defined rules.

For list of defined rules check, File -> Settings -> Editor -> Inspection. (For Mac, Android Studio -> Preferences -> Editor -> Inspection) Here you can find all rules like,

  1. non-used variables,
  2. non-used import,
  3. Abstaraction issues,
  4. Code style issues,
  5. Java Beans issues etc.

After inspection of code, Android Studio will remove such code from your files that is not necessary. It is called cleaning up code.

There are many plugins available for it. As Android Studio support by default, You can format and clean your code using this feature.