0

I tried setting up my project using instructions on below post by Diego: http://dtmilano.blogspot.com/2011/11/obtaining-code-coverage-of-running.html

On trying to launch the app using adb shell am instrument -e coverage true -w ...

I get below error:

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

I included emma.jar in the build path and deployed it inside the app and got below error:

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)

Any idea how I could resolve this?

Thanks!

user1819441
  • 127
  • 2
  • 12

2 Answers2

0

It seems you should execute this command:

"ant instrument"

because you have such an error info: ****Could not find method com.vladium.emma.rt.RT.r

Ting Su
  • 1
  • 2
  • What does "ant instrument" work for into this context? – emecas Dec 27 '14 at 19:14
  • I also have read the link you mentioned: http://dtmilano.blogspot.com/2011/11/obtaining-code-coverage-of-running.html, and tried the example. In that tutorial, you need to "run instrument" to instrument the app under test. Because in your logcat info, it shows it can not find methods from emma, e.g., "Could not find method com.vladium.emma.rt.RT.r" – Ting Su Dec 28 '14 at 20:26
  • BTW, have you ever tried to monitor the code coverage for an apk file without source code? I recently tried to do this, but also run into a problem, you can take a look at this post: http://stackoverflow.com/questions/27662988/how-to-get-code-coverage-using-emma-from-an-android-apk-file-without-source-code – Ting Su Dec 28 '14 at 20:32
0

Below link helped me to resolve the issue. I am using so added the below dependencies:

Added the below dependency in the build.gradle file present in the app folder.

compile group: 'org.jruby', name: 'jruby', version: '1.4.1'

And the below dependency in the build.gradle file present at the project folder.

maven {
            url "https://repo1.maven.org/maven2/"
        }

Choose your dependency from the below link: http://snacktrace.com/artifacts/org.jruby/jruby/1.4.1/com.vladium.emma.rt.RT

learner
  • 786
  • 7
  • 17