(EDIT: my old answer used Jacoco to get the code. With the latest Android Studio updates, you can get code coverage without third-party tools)
With the new Android studio, you can run your unit tests and view coverage in the IDE.
First, you will need to run your unit tests in the IDE. (if you can already, skip this step)
This guide and demo will help you.
Secondly, you need to create a JUnit Run configuration

Inside this configuration you can choose
- Type of test: "Everything in the package"
- Package: [package where your tests are located, for example: "com.myapp.tests"]
- Search for tests: Interdependence between modules (may be the difference for your settings)
- VM -options: -ea
- Working directory: [directory of your project]
- Use mod class path: [select your module]
If you are having trouble creating a JUnit Run configuration, you should contact this for help.
Finally, in the latest version of Android Studio, you can launch your JUnit-Run Configuration by clicking the "Run with Coverage" button.
Caleb source share