Here is an explanation of how I decided this for future reference. The problem with tests working in debugging but not in release was due to the fact that Log.d (and friends from the android framework) mocked incorrectly. The reason it works when building as an issue is because our login was based on this property from the build configuration. Basically we have if (BuildConfig.type! = "Release") Log.d (...), and since the compiler removes this block due to the final value, it is not called when testing the release. To mock the static Log.d method, I used PowerMock. Focusing was easy, but setting up a Power Mock is really a hassle, so there may perhaps be ways to do it.
Psixo source share