Error message ArrayIndexOutOfBounds with Clover for Android


I am trying to use the Clover-for-Android plugin in Eclipse for my Test setup. I followed the instructions on:

Running the App Project on the device works, code coverage can be viewed after manually using the app. When I run the TestProject with "Run as Android JUnit Test" the tests fail with:


at com.cenqua.clover.PerTestRecorder$One.set(

at com.cenqua.clover.PerTestRecorder$ThreadVisibilityStrategy$SingleThreaded.set(

at com.cenqua.clover.GrowableCoverageRecorder$

at eu.fpetersen.robobrain.behavior.BehaviorFactory.getInstance(

at eu.fpetersen.robobrain.behavior.test.BehaviorFactoryTest.__CLR3_1_7ramiuiez(

at eu.fpetersen.robobrain.behavior.test.BehaviorFactoryTest.testBehaviorCreation(

at java.lang.reflect.Method.invokeNative(Native Method)

at android.test.AndroidTestRunner.runTest(

at android.test.AndroidTestRunner.runTest(

at android.test.InstrumentationTestRunner.onStart(


The App-Project is set in the BuildPath of the Test-Project and it is exported. The files are successfully created in the data folder on the device. I have no idea what to do to solve this issue.

Do you have any ideas? Feel free to ask for more information about my setup. I don't know what else is worth sharing right here.

Thanks in advance,

Frederik P.

7 answers

1 accepted

1 vote

I found a bug - it's reported in CLOV-1194. As a workaround, disable per-test instrumentation:

  • open Project Properties dialog > Clover page > Test Classes tab
  • select "Don't look for tests, assume everything is application source" option


I should add, that I found out that some tests run successfully. They also use the MainApp's code and I can't really find a big difference to those methods that fail. The Errors in the different tests do not originate from the same line of my code but it's always the same line of the clover code that throws the exception. As seen above.

if you would like to have a peak into the source code, feel free to do so:;a=tree

MainApp: RoboBrain

TestProject: RoboBrainTest

0 vote

Hi Frederik,

1) Does this exception occur every time you run your tests?

2) Does it happen also when tests are launched first time after a full rebuild (full workspace clean + removal of clover database + removal of coverage files)?

3) How large is your project (number of statements)?

0 vote

Clover for Android is using a coverage recorder with a dynamically resizable buffer with an initial capacity of 1 million elements (statements + branches + methods). I suspect that your project has exceeded initial buffer size. It can happen also when actual code base is smaller, because every time class is recompiled it adds new data to clover.db database. So the point 2) should help.

Hi Marek,

thanks for your answers. I'll answer your 3 questions:

1) Yes it does occur every time. Some tests run through, most don't.

2) Yes it happens everytime. I did clean up everything several times, did a full rebuild and still it fails.

3) It has only 1,207(App) + 443(Tests) statements according to the clover coverage explorer. The project is really small, I can't imagine that its size could be a problem..

So I just tried removing the clover databases again, removing the coverage files, rebuilding everything, and running the tests again. No luck. It still fails with the stack trace above.

Thanks again for your help!

0 vote

Hi Frederik,

Could you try the following workaround:

  • open Project Properties dialog > Clover page > Test Classes tab
  • select "Don't look for tests, assume everything is application source" option

This will disable per-test coverage so exception should disappear. (Unfortunately Test Contributions and Test Run Explorer will be empty).


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted 2 hours ago in Off-topic

Miscellaneous Monday - Help, I'm Surrounded!

I want to talk about chores today, specifically ones that you absolutely hate doing. I bring this up because this weekend I cleaned the tub. This isn't a normal task for me. I do absolutely whatever...

140 views 53 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you