36

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:

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.

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$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)

And here's my build.gradle file (untouched):

// 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.

nt827
  • 450
  • 1
  • 5
  • 12
  • include your module's build.gradle files as well. – Piyush Agarwal Jan 26 '14 at 15:00
  • make sure you are having `apply plugin: 'android'` in your module's build.gradle file. – Piyush Agarwal Jan 26 '14 at 15:49
  • What are you doing to get this error? Is this when the project is first created? Or is it a build in Android Studio, and this shows up in the messages, or in the Gradle Console? Or is this building from the command line? – Scott Barta Jan 26 '14 at 16:12
  • I included the contents of my build.gradle file already in the post. I'm creating a new project and trying to build/make (from Android Studio) to just test and get it to run. I get errors in the Gradle console, Event Log, and idea.log. – nt827 Jan 26 '14 at 17:22
  • Sorry I didn't see your comments before -- StackOverflow doesn't seem to notify me anymore when comments are added to a post I've commented on. Some more questions -- are you trying to use a local installation of Gradle or the Gradle wrapper? Are you doing anything to try to customize the Gradle version (You said you're just creating a new project and taking defaults, but I'll ask anyhow). Are you using the Android SDK bundled with Studio or your own copy? This bug seems like some version conflict between different tools, but I'm not quite sure what it is. – Scott Barta Jan 29 '14 at 00:14
  • I'm using everything, except the JDK, that comes bundled with Android Studio. I was just using the project defaults to build and was getting this error. In terms of Gradle, I think the default on the project is the wrapper. I uninstalled 0.4.3 for now and installed 0.3.2 and that has been working. I'd like to get the newer version working though. – nt827 Jan 29 '14 at 13:29

7 Answers7

25

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

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>

In the case of your specific project called XXX, you would be looking to correct the file called 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.

David
  • 15,894
  • 22
  • 55
  • 66
Stephan Branczyk
  • 9,363
  • 2
  • 33
  • 49
  • Seems odd that this is happening on a newly-created project, though. – Scott Barta Jan 26 '14 at 16:10
  • 3
    I only have one node for companent with Name="FacetManager". Should I still remove it? When I remove it, still no good. – nt827 Jan 26 '14 at 17:33
  • And if that still doesn't work, I'd re-install everything from scratch. I've had to do that a couple of times (although honestly, I'm not running on the latest Android Studio, my copy of Android Studio is stable now, and I'm far too afraid to upgrade it) – Stephan Branczyk Jan 26 '14 at 22:26
  • I always backup my entire VM before updating Android Studio! It's pretty flaky. –  Jan 26 '14 at 22:41
  • 1
    The uninstall and reinstall did it. I'm on 0.3.2 and everything is working fine. Thanks! – nt827 Jan 29 '14 at 13:26
  • Thanks - this worked for me. And it was a brand new project in Android Studio 0.4.3 too! – bkurzius Feb 03 '14 at 18:58
  • Worked for me too...I just removed the offending components. BTW, it was on a brand new project in the latest version of Android Studio – Agile Jedi Jun 26 '14 at 21:27
  • Thanks, removing the entire FacetManager worked for me ... am trying Android Studio for the first time with the CardboardSample project. Had previously set up sdk for use with Eclipse. – JJones Dec 17 '14 at 12:31
  • Thanks @StephanBranczyk you are Saviour. – AAnkit Apr 13 '15 at 05:58
14

This worked for me. Open your parent/root build.gradle file.

Add this at the first line: task assemble{}

arshu
  • 11,805
  • 3
  • 23
  • 21
3

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

Gal Bracha
  • 19,004
  • 11
  • 72
  • 86
2

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.

nt827
  • 450
  • 1
  • 5
  • 12
1

You might need to add settings.gradle with subprojects.

The settings.gradle file should be placed at the root of the project and contain at least the following line:

include ':app'

Reference: https://georgik.rocks/missing-run-or-debug-action-in-android-studio/

dianakarenms
  • 2,609
  • 1
  • 22
  • 22
palimad
  • 67
  • 3
0

Try to run for new versions of gradle

$ gradle init

It will create initial build.gradle. To see all gradle comands just run

$ gradle
Roman
  • 19,236
  • 15
  • 93
  • 97
0

It worked for me just by Rebuilding the project.

Build -> Rebuild Project

Prakash Bala
  • 315
  • 5
  • 12