generating code coverage report for android test p

2019-01-28 22:26发布

问题:

i am trying to get a coverage report for my android junit test project and following this guide to do so

android update test-project -m <path to app project> -p <path to test project>

worked fine. it generated a build.xml and updated project.properties, local.properties and proguard.cfg.

but when I change directory to test project directory and enter command

ant coverage

it gives me this error.

BUILD FAILED
Target "coverage" does not exist in the project "My Project Test".

Total time: 0 seconds

I am using windows xp.

回答1:

Which SDK Tools version are you using? If it is 14 or later, you need to use ant emma debug install test instead of ant coverage



回答2:

  1. Go to Java build Path
  2. Go to Source
  3. Change Default output folder from: ProjectName/classes to Project/bin/classes


回答3:

Try ant all clean emma debug install test in the test project root after cleaning, updating and building both the projects