以编程方式调用Gradle ./gradlew assembleDebug crashlyticsUploadDistributionStageDebug

时间:2016-02-10 09:28:22

标签: gradle android-gradle gradlew

如何从自定义任务中执行./gradlew assembleDebug crashlyticsUploadDistributionStageDebug?我尝试了这段代码,但它不起作用:

task myTask {
doFirst {
    tasks.assembleStageDebug().execute()
    tasks.crashlyticsUploadDistributionStageDebug().execute()
}}

1 个答案:

答案 0 :(得分:1)

您永远不应该直接执行任务。而是定义它们之间的依赖关系:

task myTask
myTask.dependsOn assembleStageDebug, crashlyticsUploadDistributionStageDebug