title: Mockito exception when Espresso added to project
body: <p>I was successfully using Mockito in my project, then I decided to add some Espresso testing (As described here:<a href="https://developer.android.com/training/testing/ui-testing/espresso-testing.html#build" rel="nofollow">https://developer.android.com/training/testing/ui-testing/espresso-testing.html#build</a>) and I am stuck - when I add espresso to my build.gradle and I get problems with Mockito.</p>
  
  <p>My dependencies in build.gradle when Mockito is working OK, e.g. my tests which use Mockito pass:</p>
  
  <pre><code>dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:23.4.0'
      testCompile 'junit:junit:4.12'
      //Mockito framework
      testCompile 'org.mockito:mockito-core:1.10.19'
      // https://mvnrepository.com/artifact/org.powermock/powermock-module-junit4
      testCompile group: 'org.powermock', name: 'powermock-module-junit4', version: '1.6.4'
      testCompile 'org.powermock:powermock-api-mockito:1.5.5'
      androidTestCompile ('com.android.support:support-annotations:23.4.0')
      //androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.2')
  }
  </code></pre>
  
  <p>When I uncomment the last line to include com.android.support.test.espresso:espresso-core:2.2.2 and I run my tests again I get the following error for some of them:</p>
  
  <pre><code>java.lang.IllegalAccessError: class org.mockito.internal.creation.jmock.ClassImposterizer$1 cannot access its superclass org.mockito.internal.creation.cglib.MockitoNamingPolicy
  
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      at org.mockito.internal.creation.jmock.ClassImposterizer.&lt;clinit&gt;(ClassImposterizer.java:38)
      at org.mockito.internal.creation.CglibMockMaker.createMock(CglibMockMaker.java:23)
      at org.powermock.api.mockito.internal.mockmaker.PowerMockMaker.createMock(PowerMockMaker.java:43)
      at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:33)
      at org.mockito.internal.MockitoCore.mock(MockitoCore.java:59)
      at org.mockito.Mockito.spy(Mockito.java:1368)
      at todolistj.todolist.unittest.CustomClass.size(CustomClass.java:54)
  </code></pre>
  
  <p>All the tests that fail are failing either on <code>Mockito.spy</code> or on <code>Mockito.mock</code> methods. Something like:</p>
  
  <pre><code>CustomClass1 li1 = Mockito.spy(new CustomClass1(somevar));
  </code></pre>
  
  <p>or</p>
  
  <pre><code>View vm= Mockito.mock(View.class);
  </code></pre>
  
  <p>Any help would be appreciated!</p>