Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Task with name 'testDebug' not found in project ':module'

As of com.android.tools.build:gradle:1.3.0 you can run into Task with name 'testDebug' not found in project ':module'.

As in the earlier stage of the build environment it was not possible to test library modules properly using Robolectric & Java this workaround was created:

afterEvaluate { project ->
    android.libraryVariants.each { variant ->
        println variant.name
        println tasks
        tasks.getByName("test${variant.name.capitalize()}") {
            dependsOn "assemble${variant.name.capitalize()}"
        }
    }
}

With version 1.3.0 this is broken.

like image 862
Niklas Avatar asked Aug 11 '15 09:08

Niklas


1 Answers

They have changed the name from testDebug to testDebugUnitTest hence the code above needs to be changed to:

afterEvaluate { project ->
    android.libraryVariants.each { variant ->
        println variant.name
        println tasks
        tasks.getByName("test${variant.name.capitalize()}UnitTest") {
            dependsOn "assemble${variant.name.capitalize()}"
        }
    }
}
like image 154
Niklas Avatar answered Sep 28 '22 08:09

Niklas