Lint check for unused methods (command line)

Run lint from the command line

You can use the Gradle wrapper to invoke the lint task for your project by entering one of the following commands from the root directory of your project:

On Windows:

gradlew lint

On Linux or Mac:

./gradlew lint

You should see output similar to the following:

> Task :app:lint
Ran lint on variant release: 5 issues found
Ran lint on variant debug: 5 issues found
Wrote HTML report to file:<path-to-project>/app/build/reports/lint-results.html
Wrote XML report to file:<path-to-project>/app/build/reports/lint-results.xml

When the lint tool completes its checks, it provides paths to the XML and HTML versions of the lint report. You can then navigate to the HTML report and open it in your browser, as shown in figure 2.

you can check the docs "Improve your code with lint checks"


If your project includes build variants, and you instead want to run the lint task for only a specific build variant, you must capitalize the variant name and prefix it with lint.

gradlew lintDebug

To learn more about running Gradle tasks from the command line, [read Build Your App from the Command Line.][1]

  [1]: https://developer.android.com/studio/build/building-cmdline

Maybe try a combination of ./gradlew lint with grep using the linux pipe symbol and filter out all of the issues related to unused methods.

./gradlew lint | grep 'unused' you can modify the grep string per your need.