Android instrumentation testing with mockito

Not sure why

MockitoAnnotations.initMocks(this);

cause the crash, I end up with using

System.setProperty("dexmaker.dexcache", InstrumentationRegistry.getTargetContext().getCacheDir().getPath());

instead.