Create pre build event to copy files to assets folder in Android application

Can you try this configuration:

gradle.projectsEvaluated {
     preBuild.dependsOn(copyFiles)
}

update: there are many commands the copy task can do for you. from the docs here are examples:

task anotherCopyTask(type: Copy) {
// Copy everything under src/main/webapp
from 'src/main/webapp'
// Copy a single file
from 'src/staging/index.html'
// Copy the output of a task
from copyTask
// Copy the output of a task using Task outputs explicitly.
from copyTaskWithPatterns.outputs
// Copy the contents of a Zip file
from zipTree('src/main/assets.zip')
// Determine the destination directory later
into { getDestDir() }

}

if you just want to copy from one source directory to another you can do this :

task copyFiles(type: Copy) {
    from 'pathToMyAssets'
    into 'AndroidStudioAssetsFolderPath'
}

UPDATE do this in your app's build.gradle at the very bottom:

task copyFiles(type: Copy) {
    from 'Users/kostya/repo_amc_mobile_promo/Common/'
    into 'Users/kostya/repo_amc_mobile_promo/Android/AMC_Mobile_Promo2/app/src/main/assets'
}

preBuild.dependsOn(copyFiles)

According to documentation here's how to copy a file via gradle:

task myCopyTask(type: Copy) {
    from file("${buildDir}/reports/my-report.pdf")
    into file("${buildDir}/toArchive")
}

To do it before build you must add the following line:

preBuild.dependsOn(myCopyTask)

You can use absolute or relative path that may use some of the project properties. To ensure path of project properties do not hesitate to print it using :

println file('${buildDir}')