Cmds to enable EMMA instrumentation

84 views
Skip to first unread message

sm8

unread,
Oct 31, 2012, 12:55:30 AM10/31/12
to adt...@googlegroups.com

The following web site gives detailed instructions on building an Android app from the command line:http://geosoft.no/development/Android.html

If I want to enable EMMA instrumentation, for the Android build what are the extra commands that I would need to do?

I tried the following:

java -cp <Android sdk path>\tools\lib\emma.jar emma instr -instrpath obj -outdir objinstr

dx --dex --output=<full_path>\bin\classes.dex <full_path>\objinstr <Android sdk path>\tools\lib\emma_device.jar

Then followed the remaining instructions to build the APK (package the classes.dex using aapt, sign the app and zipalign).

I am able to install the resultant APK on the device, but when I try to launch the app it crashes and I get the following error:

    W/dalvikvm( 1492): Exception Ljava/lang/Error; thrown while initializing Lcom/vladium/emma/rt/RT;

    W/dalvikvm( 1492): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lcom/mycompany/package1/HelloAndroid;

    W/dalvikvm( 1492): Class init failed in newInstance call (Lcom/mycompany/package1/HelloAndroid;)

D/AndroidRuntime( 1492): Shutting down VM

What am I missing while adding the instrumentation?

Thanks!

Tor Norbye

unread,
Oct 31, 2012, 11:00:41 AM10/31/12
to adt...@googlegroups.com

I believe there's some support for emma via the builtin Ant support.

First add ant support:

$ cd /my/project/dir
$ ~/dev/sdks/tools/android update project -p .
Updated local.properties
No project name specified, using Activity name 'MainActivity'.
If you wish to change it, edit the first line of build.xml.
Added file ./build.xml
Updated file ./proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.

If you now run "ant" you'll see the build targets listed including this one:

     [echo]    emma:      Transiently enables code coverage for subsequent
     [echo]               targets.

-- Tor
Reply all
Reply to author
Forward
0 new messages