Unable to get Emma Coverage for Android [duplicate

2019-07-20 02:27发布

问题:

Possible Duplicate:
generating code coverage report for android test project

I am facing a problem in Emma Coverage for an Android Project.
I am able to generate the build.xml for the Project and the Test Project.
But when I run "ant coverage" I do get the following error:

Buildfile: C:\Documents and Settings\user\workspace\HelloAndroidTest\build.xml
BUILD FAILED
Target "coverage" does not exist in the project "HelloAndroidActivityTest".

Total time: 0 seconds

Do I need to change my build.xml file for any of the projects? If Yes, what would be the optimum change?

回答1:

The newest SDK uses emma by putting emma in front of the build:

ant emma debug install
ant emma debug install test

The first is run from your project director, the second the test directory. Doing so will generate the full coverage report. Note: That in order for this to work you do need to be running the emulator or a on a rooted phone.

For more details see: http://developer.android.com/guide/developing/building/building-cmdline.html