Up to the latest Android Studio and Gradle plugin update (both 2.2) this code cleaned my output folder before building library and copied final archive to it after. Now it fails with error "Could not get unknown property 'assembleDebug' for project ':Tools' of type org.gradle.api.Project."

There are several similar but not the same questions, I did read before posting.

Is there any fix, way around or totally different way to do what I want it to do?

```
apply plugin: 'com.android.library'

android {
    compileSdkVersion 24
    buildToolsVersion '24.0.0'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
}

task cleanBuildDirAndOut(type: Delete) {
    delete buildDir
    delete '../OUT/tools.aar'

    doLast {
        println ('Deleted Tools buildDir')
        println ('Deleted tools.aar')
    }
}

task copyLibDebug(type: Copy) {
    from 'build/outputs/aar/Tools-debug.aar'
    into '../OUT'
    rename ('Tools-debug.aar', 'tools.aar')

    doLast {
        println ('Copied tools.aar (debug) to Out')
    }
}

assembleDebug.dependsOn copyLibDebug
preBuild.dependsOn cleanBuildDirAndOut

```