Android's plugin debug output not generated

I’m using Gradle 1.9, the version of the android plugin is 0.7.3. As you probably know, the android plugin has two outputs - debug and release.

My project depends on another project.

I’ve created my own task to execute the unit tests. It depends on the debug output. Here’s its definition in the build.gradle file of the main project.

sourceSets {
    unitTest {
        java.srcDirs = ['tests']
    }
}
  dependencies {
    unitTestCompile files("build/classes/debug") //This is the debug output of the main project
    unitTestCompile files("../otherproject/build/classes/debug") //This is the debug output of the other project
    unitTestCompile 'junit:junit:4.11'
    unitTestCompile 'org.robolectric:robolectric:2.2'
    unitTestCompile 'com.google.android:android:4.1.1.4'
        unitTestCompile 'org.mockito:mockito-all:1.9.5'
}
  configurations {
                unitTestCompile.extendsFrom compile
        unitTestCompile.extendsFrom runTime
        unitTestRuntime.extendsFrom unitTestCompile
                          unitTestEclipseCompile {
            extendsFrom unitTestCompile
            exclude group: "com.google.android", name: "android"
            transitive = false
        }
        }
  task unitTest(type:Test, dependsOn: assemble) {
        description = "run unit tests"
        testClassesDir = project.sourceSets.unitTest.output.classesDir
        classpath = project.sourceSets.unitTest.runtimeClasspath
       }

The problem is that the debug output is not generated, so when I type

gradle unitTest

in the command line, I get

java.lang.ClassNotFoundException

.

In order for the debug output to be generated, I have to explicitly run

gradle assembleDebug

before I run unitTest.

I’ve tried the following things, neither of which has worked:

unitTest.dependsOn assembleDebug
assembleDebug.outputs.upToDateWhen { false }

The problem doesn’t go away regardless of whether the task is out of date or not, So, for example, if I make a slight modification in one of the source files, and then run

gradle unitTest

, the release output is generated with the new .class files, but not the debug output.