gpt4 book ai didi

android - 使用 tasks.getByName 找不到名称的任务

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:10:00 28 4
gpt4 key购买 nike

我想按任务顺序创建任务

task fabricUploadDebug(type: Exec) {
dependsOn 'clean'
dependsOn 'compileDebugSources'
dependsOn 'assembleDebug'
dependsOn 'installDebug'
dependsOn 'crashlyticsUploadDistributionDebug'
tasks.getByName('compileDebugSources').mustRunAfter('clean')
tasks.getByName('assembleDebug').mustRunAfter('compileDebugSources')
tasks.getByName('installDebug').mustRunAfter('assembleDebug')
tasks.getByName('crashlyticsUploadDistributionDebug').mustRunAfter('installDebug')}

我正在尝试从右侧面板“Gradle”运行任务,但错误是

Gradle sync failed: Task with name 'compileDebugSources' not found in project ':app'. // // Consult IDE log for more details (Help | Show Log) (2s 87ms) (moments ago)

这里是关于 https://stackoverflow.com/a/32909428/2425851

更新我尝试输出我所拥有的所有任务:

 for(item in tasks){
println "group= "+item.group+" ,path= "+item.path
}

但我只有这个:为什么我无法访问其他任务?

group= build ,path= :app:assemble
group= build ,path= :app:assembleAndroidTest
group= build ,path= :app:buildDependents
group= build ,path= :app:buildNeeded
group= verification ,path= :app:check
group= build ,path= :app:cleanBuildCache
group= null ,path= :app:compileLint
group= verification ,path= :app:connectedCheck
group= null ,path= :app:consumeConfigAttr
group= verification ,path= :app:deviceCheck
group= null ,path= :app:extractProguardFiles
group= null ,path= :app:fabricUploadDebug
group= null ,path= :app:lint
group= null ,path= :app:preBuild
group= null ,path= :app:resolveConfigAttr
group= Android ,path= :app:sourceSets
group= Install ,path= :app:uninstallAll

enter image description here

最佳答案

这应该适合你:

task fabricUploadDebug(type: Exec), dependsOn : ['clean',
'compileDebugSources',
'assembleDebug',
'installDebug',
'crashlyticsUploadDistributionDebug'] {

compileDebugSources.dependsOn clean
assembleDebug.dependsOn compileDebugSources
installDebug.dependsOn assembleDebug
crashlyticsUploadDistributionDebug.dependsOn installDebug
}

关于android - 使用 tasks.getByName 找不到名称的任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48439464/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com