找不到项目属性“uninstallDebug” [英] Could not find property 'uninstallDebug' on project

查看:172
本文介绍了找不到项目属性“uninstallDebug”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目,我想我的运行自定义任务MyTask运行卸载之前发生。 code为相同的

In my project I want to run my custom task "MyTask" to run before uninstall happens. Code for the same is

uninstallDebug.dependsOnMyTask

当我运行它,它失败,出现错误

When I run this, it fails with an error

找不到项目属性uninstallDebug

然而,我看到这个名字的摇篮窗口中列出的任务的Gradle。
什么可能去错了吗?

whereas, I see a gradle task listed in the Gradle window with that name. What may be going wrong?

推荐答案

uninstallDebug 连同其他几个任务,特别是那些有韵味或buildType的名字在他们的名字创建并添加到gradle这个taskGraph在配置一步的Andr​​oid插件很晚。这也就意味着,当你发现是你可能无法通过名称年初引用它们在配置步骤,因为它们不存在。

uninstallDebug along with several other tasks, especially those that have flavor or buildType name in their name are created and added to the gradle taskGraph quite late in the configuration step by the android plugin. What that means, as you have discovered is that you may not be able to refer to them by name early in the config step since they do not exist yet.

作为其他的答案指出,解决这个问题的办法是要等到有问题的任务添加到taskgraph。您可以使用行 uninstallDebug.dependsOnMyTask在任 gradle.taskgraph.whenRead {} project.afterEvaluate {}

The way around this as the other answers point out is to wait until the tasks in question are added to the taskgraph. You can use your line uninstallDebug.dependsOn "MyTask" in either gradle.taskgraph.whenRead{} or project.afterEvaluate {}

这篇关于找不到项目属性“uninstallDebug”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆