Search code examples
androidcode-coverageemma

Android code coverage with EMMA build.xml


I'm very new to using EMMA and I'm trying to generate some code coverage for a test project I have but keep getting this error when I try to run

I have been working from multiple tutorials online and have stumbled across this one recently which seems the most simplified to use http://blog.rabidgremlin.com/2010/11/19/android-tips-generating-a-coverage-report-for-your-unit-tests/

from the cmd line in my workspace i run:

C:\Users\roward\workspace\my-app>android update test-project -m C:/Users/roward/
workspace/my-app -p C:/Users/roward/workspace/my-app-test
Resolved location of main project to: C:\Users\roward\workspace\my-app
Updated project.properties
Updated local.properties
Updated file C:\Users\roward\workspace\my-app-test\proguard-project.txt
Updated ant.properties

This seems to work.

Then I run :

C:\Users\roward\workspace\my-app-test>ant coverage

and get this error

Buildfile: C:\Users\roward\workspace\my-app-test\build.xml

BUILD FAILED
Target "coverage" does not exist in the project "my-app-test".

Total time: 0 seconds

I got these errors when I tried the command below for the heck of it but figured if it can shed more light on what I'm doing wrong I might as well post it.

>ant emma debug install test


BUILD FAILED
C:\Users\roward\Documents\adt-bundle-windows-x86_64-20140321\adt-bundle-windows-
x86_64-20140321\sdk\tools\ant\build.xml:601: Invalid file: C:\Users\roward\works
pace\appcompat_v7_6\build.xml
C:\Users\roward\Documents\adt-bundle-windows-x86_64-20140321\adt-bundle-windows-
x86_64-20140321\sdk\tools\ant\build.xml:620: The following error occurred while
executing this line:

Solution

  • Since SDK 14 you must use :

    ant emma debug install test
    

    instead of

    ant coverage