Error:Could not find property 'assembleDebug' on project ':app'

  1. find which task is depending on assembleDebug task
  2. changing the following did the trick for me at least:

from:

task findbugs(type: FindBugs, dependsOn: assembleDebug)

to:

task findbugs(type: FindBugs, dependsOn: "assembleDebug")

so just surrounding the task with quotes was enough.


It's from In that case, a workaround is this way:

//assembleDebug.doFirst {
//    println '=============assembleDebug============='
//}
//assembleRelease.doFirst {
//    println '=============assembleRelease============='
//}
//

// =======>

tasks.whenTaskAdded { task ->
    if (task.name == 'assembleDebug') {
        //task.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
        println '=============assembleDebug============='
    } else if (task.name == 'assembleRelease') {
        //task.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
        println '=============assembleRelease============='
    }
}