簡體   English   中英

Android Gradle任務:版本構建的connectedInstrumentTest?

[英]Android Gradle task: connectedInstrumentTest for Release Build?

有沒有辦法針對Release構建類型或任何其他自定義構建變體運行測試?

connectedInstrumentTest任務的默認行為是僅針對Debug構建變​​體運行測試

有任何想法嗎?

AFAIK connectedInstrumentTest針對使用testBuildType屬性指定的構建類型運行。 您可以嘗試從命令行參數中進行動態讀取:

android {
    testBuildType obtainTestBuildType()
}

def obtainTestBuildType() {
    def result = "debug";

    if (project.hasProperty("testBuildType")) {
        result = project.getProperties().get("testBuildType")
    }

    result
}

然后用它來調用它

./gradlew connectedInstrumentTest -PtestBuildType=release

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM