I have used the lint(Analyze->Inspect Code...) and find out unused methods and resources. All the unused resources removed by Refractor->Remove unused R
This can be achieved by using the built-in inspection Java | Declaration redundancy | Unused declaration
.
To run it on whole project go to Analyze -> Run inspection by name...
, type Unused declaration
and select desired scope.
Then carefully check output and mark some classes as entry points if needed.
Now you can select Unused declaration
node in list and perform Safe delete
action on all unused declarations at once.
For Kotlin there is similar inspection Kotlin | Redundant constructs | Unused symbol
.