How to Run task before compilation in Android Project

Hi I’m new to Gradle .

I’ve got a task that needs to run before the Android build. Task copies a jar file into the libs directory. Somehow, this happens too late for the Android build. My android build always fails the first time after a clean. Then the second time it works ( since the jar file is there then). How do run the task that copies the jar file soon enough

I wrote task to copy the files into libs folder .

given preBuild.dependsOn “MyCopyTask” . it is copying successfully . but I’m getting symbols not found .

dependencies {
compile fileTree(dir: ‘libs’, include: [’*.jar’])
}
sourceSets {
main {
jniLibs.srcDirs = [‘libs’]
}
}

task copyDeployEmailLib (type: Copy) {
from "\Test\build\libs"
into “libs”
}
Kindly help me to resolve this issue