Java – Android Studio 1.4 – Task ‘bin’ not found in root project ‘assemble’

Android Studio 1.4 – Task ‘bin’ not found in root project ‘assemble’… here is a solution to the problem.

Android Studio 1.4 – Task ‘bin’ not found in root project ‘assemble’

I upgraded to Android Studio 1.4 yesterday. Before upgrading, I can use “assemble” in the task field to run Gradle assemble under a run/debug configuration.

Now, I’m getting the following error:

3:22:48 PM: Executing external task ‘assemble’…

FAILURE: Build failed with an exception.

  • What went wrong:
    Task ‘assemble’ not found in root project ‘bin’.

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

BUILD FAILED

Total time: 0.095 secs
Task ‘assemble’ not found in root project ‘bin’.
3:22:48 PM: External task execution finished ‘assemble’.

I tried to > this based on Add “task assemble{}” to the root build.gradle file and Google Code forums.

I also tried deleting

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

According to this answer on Stack Overflow My root build.gradle is as follows:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'

 NOTE: Do not place your application dependencies here; they belong
     in the individual module build.gradle files
    }

}

allprojects {
    repositories {
        jcenter()
    }
}

I also tried importing the file as a new Android Studio project. However, I was able to generate an app-debug .apk by running it through the emulator. I also tried cloning my Bitbucket repository to the last committed version yesterday to import into Android Studio, but that didn’t work either. I’m still new to Android stuff and confused about it. Thanks for your help.

Edit —
I fixed this issue and am posting so it might help others.
I was able to assemble from the command line. I’m on Windows, so the command is:

gradlew.bat assembleDebug

It worked.
I quit Android Studio entirely. I’m not sure if this step is important. Then I open the Gradle sidebar and it’s empty. I hit the refresh button and suddenly the Gradle task appears again and I am able to run the Gradle APK assembly again from the run option.

Solution

On Linux you can use this command:

gradlew assembleDebug

There are two files for executing Gradle:

  1. gradlew.bat for Windows
  2. gradlew is available for Linux

Related Problems and Solutions