Gradle:失败:无法确定要执行的任务 [英] Gradle: FAILURE: Could not determine which tasks to execute
问题描述
升级到 Android Studio 0.2.0 并得到以下错误.应用建议的解决方案后错误得到解决,但现在出现以下错误.
Upgraded to Android Studio 0.2.0 and got the following error. The error got resolved after applying suggested solution but now the following error appeared.
Gradle:
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'assemble' not found in root project 'MerlinCheckProject'.
* Try:
Run gradle tasks to get a list of available tasks.
我不知道错误是如何解决的.感谢帮助.
I have no clue what the error is how to solve it. Appreciate help.
推荐答案
Remove
来自您的 iml
文件.
Remove <component name="FacetManager"> ... </component>
from your iml
file.
来自 http://tools.android.com/knownissues:
如果您收到以下错误消息:
If you get the following error message:
摇篮:失败:无法确定要执行的任务.
Gradle: FAILURE: Could not determine which tasks to execute.
出了什么问题:在根项目MyProject"中找不到任务assemble".
What went wrong: Task 'assemble' not found in root project 'MyProject'.
试试:运行 gradle tasks 以获取可用任务的列表.
Try: Run gradle tasks to get a list of available tasks.
真正的问题是之前版本的 Android Studio 错误地配置了 IDEA 文件(例如 MyProject.iml
)——它添加了一个额外的 <component name="FacetManager">
不应存在的 XML 元素.在上述情况下,解决方案是编辑 MyProject.iml
并删除
部分,如下所示:
The real problem is that previous version of Android Studio misconfigured the IDEA file (e.g. MyProject.iml
) -- it added an extra <component name="FacetManager">
XML element that shouldn't be present. In the case above, the solution is to edit MyProject.iml
and to remove the <component name="FacetManager">
part as shown here:
<?xml version="1.0" encoding="UTF-8"?>
<module external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
...remove this element and everything inside such as <facet> elements...
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
...keep this part...
</component>
</module>
或者,您可以删除项目的 .idea
文件夹和 iml
文件,然后将源重新导入到新的 Android Studio 项目中.
Alternatively you could remove the project's .idea
folder and iml
files and re-import your sources into a new Android Studio project.
在下一个版本中,我们将修复这个问题——将有一个修复这个"按钮来自动为您修复.
In the next release we'll fix this -- there will be a "fix this" button to do that fix automatically for you.
这篇关于Gradle:失败:无法确定要执行的任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!