Android手动测试的Emma代码覆盖率

时间:2013-11-08 00:44:09

标签: android code-coverage monkeyrunner emma

我尝试使用Diego下面的说明来设置我的项目: http://dtmilano.blogspot.com/2011/11/obtaining-code-coverage-of-running.html

尝试使用adb shell am instrument -e coverage true -w ...

启动应用时

我得到以下错误:

E/Trace   ( 3989): error opening trace file: No such file or directory (2)
W/Trace   ( 3989): Unexpected value from nativeGetEnabledTags: 0
W/Trace   ( 3989): Unexpected value from nativeGetEnabledTags: 0
W/Trace   ( 3989): Unexpected value from nativeGetEnabledTags: 0
I/dalvikvm( 3989): ****Could not find method com.vladium.emma.rt.RT.r, referenced from method com.adobe.dps.coverage.EmmaInstrumentation.$VRi
W/dalvikvm( 3989): VFY: unable to resolve static method 27137: Lcom/vladium/emma/rt/RT;.r ([[ZLjava/lang/String;J)V
D/dalvikvm( 3989): VFY: replacing opcode 0x71 at 0x004b
W/dalvikvm( 3989): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/adobe/dps/coverage/EmmaInstrumentation;
W/dalvikvm( 3989): Class init failed in newInstance call (Lcom/adobe/dps/coverage/EmmaInstrumentation;)
D/AndroidRuntime( 3989): Shutting down VM
W/dalvikvm( 3989): threadid=1: thread exiting with uncaught exception (group=0xb4cc7908)
E/AndroidRuntime( 3989): FATAL EXCEPTION: main
E/AndroidRuntime( 3989): java.lang.ExceptionInInitializerError

我在构建路径中包含了emma.jar,并将其部署在应用程序中并得到以下错误:

E/Trace   ( 4061): error opening trace file: No such file or directory (2)
W/Trace   ( 4061): Unexpected value from nativeGetEnabledTags: 0
W/Trace   ( 4061): Unexpected value from nativeGetEnabledTags: 0
W/Trace   ( 4061): Unexpected value from nativeGetEnabledTags: 0
W/dalvikvm( 4061): ****Exception Ljava/lang/Error; thrown while initializing Lcom/vladium/emma/rt/RT;
W/dalvikvm( 4061): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lcom/package/coverage/EmmaInstrumentation;
W/dalvikvm( 4061): Class init failed in newInstance call (Lcom/package/coverage/EmmaInstrumentation;)
D/AndroidRuntime( 4061): Shutting down VM
W/dalvikvm( 4061): threadid=1: thread exiting with uncaught exception (group=0xb4cc7908)
E/AndroidRuntime( 4061): FATAL EXCEPTION: main
E/AndroidRuntime( 4061): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 4061):    at java.lang.Class.newInstanceImpl(Native Method)

知道如何解决这个问题吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

看来你应该执行这个命令:

" ant instrument"

因为你有这样的错误信息:****无法找到方法com.vladium.emma.rt.RT.r