Search code examples
androidantemma

Android, emma, ant, and ant-related errors


I'm working with some Android code created by other developers, and they've asked me to run code coverage metrics on it. It's Android 2.3.3, and they use ant for their build files. I'm running on Ubuntu, while other developers are running on windows/macs.

If I leave the SDK/tools/lib/ant/main_rules.xml file alone, I wind up with the error described at emma's sourceforge page: A class needed by class com.vladium.emma.emmajavaTask cannot be found: org/apache/tools/ant/taskdefs/Java"

This apparently is caused by having both emma_ant.jar and emma.jar in the lib directory. Needless to say, there's no mention of emma_device.jar.

If I comment out the line seeking emma.jar, I can build the project. However, when it comes time to create a test project to get instrumented code, running "ant coverage" returns

Problem: failed to create task or type emma
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

This leaves me stuck. It seems to be looking for the emma_properties.config file, but that appears to only be in emma.jar, which is commented out...

I feel like I'm going in circles and getting nothing accomplished. Any help is appreciated.


Solution

  • Consider the answer to this a case of "trying to do too much without understanding the implications."

    EMMA's sourceforge page recommends installing the emma.jar as an extension to the JRE. If you do that, you will cause conflicts with the SDK ant tools. The safest thing is to ignore the EMMA sourceforge separate build and simply use what the SDK gives you. Instructions on getting that to work are found at http://developer.android.com under the testing section.