Android 格拉德尔';s安卓&x27;s插件调试输出未生成

Android 格拉德尔';s安卓&x27;s插件调试输出未生成,android,gradle,Android,Gradle,我使用的是Gradle1.9,android插件的版本是0.7.3。 您可能知道,android插件有两个输出-调试和发布 我的项目依赖于另一个项目 我已经创建了自己的任务来执行单元测试。它取决于调试输出。 下面是它在主项目的build.gradle文件中的定义 sourceSets { unitTest { java.srcDirs = ['tests'] } } dependencies { unitTestCompile files("build/c

我使用的是Gradle1.9,android插件的版本是0.7.3。 您可能知道,android插件有两个输出-调试和发布

我的项目依赖于另一个项目

我已经创建了自己的任务来执行单元测试。它取决于调试输出。 下面是它在主项目的
build.gradle
文件中的定义

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       
}

问题是没有生成调试输出,因此当我在命令行中键入
gradle unitTest
时,我会得到
java.lang.ClassNotFoundException

为了生成调试输出,我必须在运行unitTest之前显式运行
gradleassembledebug

我尝试过以下两种方法,但都不奏效:

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

无论任务是否过期,问题都不会消失,因此,例如,如果我对其中一个源文件进行了轻微修改,然后运行
gradle unitTest
,则会使用新的
.class
文件生成发布输出,但调试输出不是这样。

为什么要使用这样一个过时的Gradle插件版本?我试过Gradle 1.12和android插件0.11.1。问题依然存在。