Jvm options in android when run gradlew test

前端 未结 3 644
无人及你
无人及你 2020-12-14 18:27

I have a project that using Robolectric for unit test purpose. This project uses Robolectric 3.0 and need to add -ea and -noverify options in Virtu

3条回答
  •  甜味超标
    2020-12-14 19:04

    I found that we can add this block to app's build.gradle to solve this problem

    tasks.whenTaskAdded { theTask ->
        def taskName = theTask.name.toString()
        if ("testDevDebug".toString().equals(taskName)) {
            theTask.jvmArgs('-ea', '-noverify')
        }
    }
    

    DevDebug is my build variant.

提交回复
热议问题