In the android studio(or more generally in the Intellij IDEA) you can specify inspection code that you want to analyze from Analyze->Inspect Code...
and then define the scope of your code.
You can see the result for my code in the below picture:
In Declaration redundancy
you can see that “someMethod” is declared unused. Also, in Probable bugs
you can find variable i
is never used.