Unit Tests work correctly when running but not when debugging in Android Studio 4.1
I fixed it by editing the current Run/Debug Configuration and choosing JAR Manifest in the Shorten command line option.
I fixed this error by editing the current Run/Debug Configuration and disabling the "Shorten command line" option. Before it was set to "classpath file" which seems to bring up the above error in some cases.