title: Android - Code coverage test errors
body: <p>I've been trying to get tests with code coverage to work in IntelliJ for a couple of hours so far, without success.</p>
  <p>First off:
  &quot;Run  with coverage&gt;&quot; without junit included in the project produces the following error (obviously)</p>
  <blockquote>
  <p>Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: junit/textui/ResultPrinter</p>
  </blockquote>
  <p>Adding junit 4.11 and hamcrest-core 1.3 to libraries, then &quot;run with coverage&quot;:</p>
  <blockquote>
  <p>!!! JUnit version 3.8 or later expected:</p>
  <p>java.lang.RuntimeException: Stub!</p>
  </blockquote>
  <p>Now, I have read that changing the dependency order in the module options fixes this.
  So after changing the order, I get this error:</p>
  <pre><code>junit.framework.AssertionFailedError: Exception in constructor: testMakeTextView (java.lang.NoClassDefFoundError: be/dave/DiversoScoreApp/MyActivity
  at be.dave.DiversoScoreApp.MyActivityTest.&lt;init&gt;(MyActivityTest.java:20)
  </code></pre>
  <p>Which points to the code below:</p>
  <pre><code>public class MyActivityTest extends ActivityInstrumentationTestCase2&lt;MyActivity&gt; {
  MyActivity myActivity;
  
  public MyActivityTest() {
      super(&quot;be.dave.DiversoScoreApp&quot;, MyActivity.class);
  }
  
  @Override
  public void setUp() throws Exception {
      super.setUp();
      myActivity = getActivity();
  }
  
  public void testMakeTextView() throws Exception {
      TextView textView = myActivity.makeTextView(&quot;Test-text&quot;, 50);
      TextView textView1 = myActivity.makeTextView(&quot;Diverso&quot;, 75);
      assertEquals(&quot;TextView Text should be correct&quot;, textView.getText(), &quot;Test-text&quot;);
      assertNotSame(&quot;TextView Text should fail&quot;, textView1.getText(), &quot;Not Diverso&quot;);
      } 
  }
  </code></pre>
  <p>I've googled and googled, but alas I've found no solution so far.</p>