I have an Android project that I am trying to run Instrumentation tests for using AndroidStudio, but when I try to run the whole class file for the tests, I get the exceptio
This is caused by Android Studio trying to execute an instrumentation test as a JUnit test.
I had to go to 'Edit Configurations...' and delete the configuration from Android JUnit group and manually add to the 'Android Instrumented Tests' group. After this I had no problem executing the tests.
In Android Studio, click Run > Edit Configurations
.
https://developer.android.com/studio/run/rundebugconfig