Android Studio 0.4.3 - 在根项目中找不到任务“组装”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21364895/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio 0.4.3 - Task 'assemble' not found in root project
提问by nt827
Updated to 0.4.3 the other day and trying to start a new project, not even use an existing project, and I get this error:
前几天更新到 0.4.3 并尝试启动一个新项目,甚至不使用现有项目,我收到此错误:
FAILURE: Build failed with an exception.
What went wrong: Task 'assemble' not found in root project 'XXX'.
Try: Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
FAILURE:构建失败,出现异常。
出了什么问题:在根项目“XXX”中找不到任务“组装”。
尝试:运行 gradle tasks 以获取可用任务的列表。使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。
Here's what I found in the log file:
这是我在日志文件中找到的内容:
2014-01-26 09:50:18,186 [ 276355] WARN - nal.AbstractExternalSystemTask - com.android.builder.model.SourceProvider.getAidlDirectories()Ljava/util/Collection;
com.intellij.openapi.externalSystem.model.ExternalSystemException: com.android.builder.model.SourceProvider.getAidlDirectories()Ljava/util/Collection;
at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:185)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:113)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:61)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.produce(RemoteExternalSystemProjectResolverImpl.java:41)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.produce(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:48)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:137)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:123)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil.execute(ExternalSystemUtil.java:471)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil.run(ExternalSystemUtil.java:549)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.run(ProgressManagerImpl.java:373)
at com.intellij.openapi.application.impl.ApplicationImpl.run(ApplicationImpl.java:420)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
at com.intellij.openapi.application.impl.ApplicationImpl.run(ApplicationImpl.java:150)
And here's my build.gradle file (untouched):
这是我的 build.gradle 文件(未修改):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
I've checked out a few posts online, but none have worked so far. Any help would be appreciated.
我已经在网上查看了一些帖子,但到目前为止都没有奏效。任何帮助,将不胜感激。
采纳答案by nt827
I had to rollback to Android 0.3.2 to get this to work with the 0.4.3 release did not work. Everything has been working fine so far.
我不得不回滚到 Android 0.3.2 才能让它与 0.4.3 版本一起工作,但它不起作用。到目前为止,一切都运行良好。
回答by Stephan Branczyk
Quick Answer
快速回答
Remove everything betweeen and including the component tag
删除包含组件标记之间的所有内容
<component name="FacetManager">
... <!-- remove all in this node
</component>`
Long Answer
长答案
See http://tools.android.com/knownissues
请参阅http://tools.android.com/knownissues
If you get the following error message:
如果您收到以下错误消息:
Gradle:
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'assemble' not found in root project 'MyProject'.
* Try:
Run gradle tasks to get a list of available tasks.
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 entire node<component name="FacetManager"> ... </component>
真正的问题是以前版本的 Android Studio 错误地配置了 IDEA 文件(例如 MyProject.iml)——它添加了一个
"<component name="FacetManager">"
不应存在的额外 XML 元素。
在上述情况下,解决方案是编辑“MyProject.iml”并删除整个节点<component name="FacetManager"> ... </component>
In the case of your specific project called XXX, you would be looking to correct the file called XXX.iml
对于名为 XXX 的特定项目,您可能希望更正名为 XXX.iml
The documentation also says to "Alternatively you could remove the project's .idea folder and iml files and re-import your sources into a new Android Studio project." Not that this solution will work for you since you can't even get a new project to build.
该文档还说“或者,您可以删除项目的 .idea 文件夹和 iml 文件,然后将您的源代码重新导入到新的 Android Studio 项目中。” 并不是说此解决方案对您有用,因为您甚至无法构建新项目。
回答by arshu
This worked for me. Open your parent/root build.gradlefile.
这对我有用。打开您的父/根build.gradle文件。
Add this at the first line: task assemble{}
在第一行添加: task assemble{}
回答by Gal Bracha
I'm sharing how I solved it - If you remove a library. you need to remember to remove it from the settings.gradle
file as well. otherwise it may build successfully through command line and not through the android studio
我正在分享我是如何解决它的 - 如果你删除了一个库。您还需要记住将其从settings.gradle
文件中删除。否则它可能会通过命令行而不是通过 android studio 成功构建
回答by palimad
You might need to add settings.gradle with subprojects.
您可能需要在子项目中添加 settings.gradle。
The settings.gradle file should be placed at the root of the project and contain at least the following line:
settings.gradle 文件应该放在项目的根目录下,至少包含以下行:
include ':app'
Reference: https://georgik.rocks/missing-run-or-debug-action-in-android-studio/
参考:https: //georgik.rocks/missing-run-or-debug-action-in-android-studio/
回答by Prakash Bala
It worked for me just by Rebuilding the project.
它只是通过重建项目对我有用。
Build -> Rebuild Project
构建 -> 重建项目
回答by Roman
Try to run for new versions of gradle
尝试运行新版本的 gradle
$ gradle init
It will create initial build.gradle. To see all gradle comands just run
它将创建初始 build.gradle。要查看所有 gradle 命令,只需运行
$ gradle