2014-01-26 50 views
14

已更新至0.4.3有一天,試圖啓動一個新的項目,甚至沒有使用現有的項目,我得到這個錯誤:過Android Studio 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.

下面是我在日誌文件中找到:

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$1.produce(RemoteExternalSystemProjectResolverImpl.java:41) 
    at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.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$3.execute(ExternalSystemUtil.java:471) 
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$2.run(ExternalSystemUtil.java:549) 
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464) 
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.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$8.run(ProgressManagerImpl.java:373) 
    at com.intellij.openapi.application.impl.ApplicationImpl$8.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$1$1.run(ApplicationImpl.java:150) 

而且這裏是我的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() 
    } 
} 

我已經CH在網上發佈了幾個帖子,但目前還沒有任何工作。任何幫助,將不勝感激。

+0

還包括您的模塊的build.gradle文件。 – pyus13

+0

確保你的模塊的build.gradle文件中有'apply plugin:'android''。 – pyus13

+0

你在做什麼來得到這個錯誤?這是項目第一次創建時的情況嗎?或者它是在Android Studio中構建的,並且在消息中或在Gradle Console中顯示?或者是從命令行建立的這座建築物? –

回答

2

我不得不回滾到Android 0.3.2以使其與0.4.3版本無效。到目前爲止,一切都很順利。

24

快速解答

刪除一切betweeen和包括組件標籤

<component name="FacetManager"> 
    ... <!-- remove all in this node 
</component>` 

長的答案

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>

在你叫XXX具體項目的情況下,你會尋找到正確稱爲XXX.iml

文件的文件也說要「另外,您可以刪除該項目的.idea文件夾和IML文件並重新導入您的來源加入到新的Android Studio項目中。「並不是說這個解決方案可以爲你工作,因爲你甚至不能建立一個新的項目。

+0

雖然,這似乎有點奇怪,這是在新創建的項目上發生的。 –

+1

我只有一個名爲=「FacetManager」的節點。我還應該刪除它嗎?當我刪除它,仍然沒有好處。 – nt827

+0

如果這仍然不起作用,我會重新安裝所有東西。我不得不這樣做了幾次(雖然老實說,我沒有在最新的Android Studio上運行,我的Android Studio副本現在很穩定,而且我太害怕升級它了) –

1

我分享我是怎麼解決它的 - 如果你刪除了一個庫。你需要記住從settings.gradle文件中刪除它。否則它可能通過命令行成功構建,而不是通過android工作室

1

這對我有效。打開你的根build.gradle文件。

添加爲第一行:task assemble{}

0

試圖爲gradle這個

$ gradle init 

它將創建初始的build.gradle的新版本上運行。查看所有剛剛運行的gradle命令

$ gradle 
相關問題