title: Test Error - NoClassDefFoundError: Failed resolution of: Lorg/hamcrest/Matchers
body: <p>I am using Espresso for Instrumented Test but got this error on the Stack Trace:</p>
  <p><img src="https://i.stack.imgur.com/2mNYT.jpg" alt="enter image description here" /></p>
  <p>The error being caused by a missing class as shown below:</p>
  <pre><code>Caused by: java.lang.ClassNotFoundException: Didn't find class &quot;org.hamcrest.Matchers&quot; on path: DexPathList[[zip file &quot;/system/framework/android.test.runner.jar&quot;, zip file &quot;/system/framework/android.test.mock.jar&quot;, zip file &quot;/system/framework/android.test.base.jar&quot;, zip file &quot;/data/app/~~vnZzxGNKnS4V6YkEf4falA==/com.example.android.architecture.blueprints.reactive.test-K_x0_yJ0hJeDHaJkDmHXRw==/base.apk&quot;, zip file &quot;/data/app/~~oeYx2MgTcILbk-vq_WPx1A==/com.example.android.architecture.blueprints.reactive-0wMHYEe95hx_1cnbdAoZAw==/base.apk&quot;],nativeLibraryDirectories
  </code></pre>
  <p>It first occurred immediately after I added this code in the Fragment Test:</p>
  <p><img src="https://i.stack.imgur.com/ICxmM.jpg" alt="enter image description here" /></p>
  <p>These are my relevant Libs on the Gradle:</p>
  <p><img src="https://i.stack.imgur.com/o2fmb.jpg" alt="enter image description here" /></p>
  <p>I have these imports:</p>
  <pre><code>import androidx.fragment.app.testing.launchFragmentInContainer
  import androidx.test.espresso.Espresso.onView
  import androidx.test.espresso.assertion.ViewAssertions.matches
  import androidx.test.espresso.matcher.ViewMatchers.*
  import androidx.test.ext.junit.runners.AndroidJUnit4
  import org.hamcrest.core.IsNot.not
  </code></pre>