我在gradle中定义了一个任务:
task makePretty(type: Delete) {
println "Make it pretty!"
}
我希望它在 android 组装并添加后运行:
makePretty.mustRunAfter assemble
不幸的是,每次我启动 gradle assemble 时,任务似乎都先执行了。
me@my_mac: ~/sources/xxx-Android 🍊 ./gradlew assembleTest
Parallel execution is an incubating feature.
Make it pretty!
执行的 Gradle 任务:
:MyProject:compileDebugNdk UP-TO-DATE
:MyProject:preBuild UP-TO-DATE
:MyProject:preDebugBuild UP-TO-DATE
:MyProject:preRcBuild UP-TO-DATE
:MyProject:preReleaseBuild UP-TO-DATE
:MyProject:preTestBuild UP-TO-DATE
:MyProject:prepareComAndroidSupportAppcompatV71901Library UP-TO-DATE
:MyProject:prepareDebugDependencies
:MyProject:compileDebugAidl UP-TO-DATE
:MyProject:compileDebugRenderscript UP-TO-DATE
:MyProject:generateDebugBuildConfig UP-TO-DATE
:MyProject:mergeDebugAssets UP-TO-DATE
:MyProject:mergeDebugResources UP-TO-DATE
:MyProject:processDebugManifest UP-TO-DATE
:MyProject:processDebugResources UP-TO-DATE
:MyProject:generateDebugSources UP-TO-DATE
:MyProject:compileDebugJava UP-TO-DATE
:MyProject:preDexDebug UP-TO-DATE
:MyProject:dexDebug UP-TO-DATE
:MyProject:processDebugJavaRes UP-TO-DATE
:MyProject:validateDebugSigning
:MyProject:packageDebug UP-TO-DATE
:MyProject:zipalignDebug UP-TO-DATE
:MyProject:assembleDebug UP-TO-DATE
我的 gradle wrapper 是 1.9 版。
我做错了什么?我做错了吗?我该如何解决?
最佳答案
看起来您正在配置生命周期中执行 println。如果你点击这些 '<<'
可能会有更多的预期行为关于android - gradle mustRunAfter 似乎不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21750343/