androidgradlerobolectricandroid-ktx

How to set -noverify option with gradle ktx for android robolectric tests?


I am using Roboelectric for unit testing an android app, and bumped into an error while trying to write to SecureStorage - java.lang.VerifyError: Expecting a stackmap frame at branch target 10

I don't need verification enabled for unit tests, so would want to disable it, but using gradle ktx and don't know the right way to set jvm flags there for the unit testing task.

Thing I tried and doesn't work:

tasks.withType<Test> {
    jvmArgs?.add("-noverify")
}


Solution

  • Try settting it in edit configuration. -ea will be there. Replace it with -ea -noverify.