D/JacocoRunner( 1737): endCoverage started!
D/JacocoRunner( 1737): java.lang.reflect.InvocationTargetException
D/JacocoRunner( 1737): java.lang.reflect.InvocationTargetException
D/JacocoRunner( 1737): at java.lang.reflect.Method.invokeNative(Native Method)
D/JacocoRunner( 1737): at java.lang.reflect.Method.invoke(Method.java:525)
D/JacocoRunner( 1737): at com.alanjeon.testing.JacocoRunner.endCoverage(JacocoRunner.java:60)
D/JacocoRunner( 1737): at com.alanjeon.testing.JacocoRunner.finish(JacocoRunner.java:93)
D/JacocoRunner( 1737): at com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner$BridgeTestRunner.finish(GoogleInstrumentationTestRunner.java:264)
D/JacocoRunner( 1737): at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:574)
D/JacocoRunner( 1737): at com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner.onStart(GoogleInstrumentationTestRunner.java:167)
D/JacocoRunner( 1737): at com.alanjeon.testing.JacocoRunner.onStart(JacocoRunner.java:87)
D/JacocoRunner( 1737): at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
D/JacocoRunner( 1737): Caused by: java.lang.IllegalStateException: JaCoCo agent not started.
D/JacocoRunner( 1737): at org.jacoco.agent.rt.internal_932a715.Agent.getInstance(Agent.java:72)
D/JacocoRunner( 1737): at org.jacoco.agent.rt.RT.getAgent(RT.java:32)
D/JacocoRunner( 1737): ... 9 more
I/GoogleInstr( 1737): Activities that are still in CREATED to PAUSED: 0
this is my code
OutputStream out = null;
try {
out = new FileOutputStream(getCoverageFilePath(getTargetContext().getPackageName()), false);
Object agent = Class.forName("org.jacoco.agent.rt.RT").getMethod("getAgent").invoke(null);
out.write((byte[]) agent.getClass().getMethod("getExecutionData", boolean.class).invoke(agent, false));
} catch (Exception e) {
Log.d(TAG, e.toString(), e);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}