Reputation: 2372
I am trying to copy a couple of files from the source tree to the directory where Gradle finally generates the apk files. The build seems to go fine but I do not seem to see the copy working. I added the following task in my modules build.gradle
task copySupportFiles(type: Copy){
from 'src/main/support'
into 'build/outputs/apk'
include '**/.dat'
include '**/.txt'
}
assembleDebug {}.doLast{
tasks.copySupportFiles.execute()
}
Upvotes: 15
Views: 8788
Reputation: 2714
Your doLast
should be placed in afterEvaluate
:
afterEvaluate {
assembleRelease.doLast {
tasks.copySupportFiles.execute()
}
}
Upvotes: 4
Reputation: 349
As mentioned by @Steffen Funke in comments the error is in the additional asterisk :
'**/.dat'
should be '**/*.dat'
Upvotes: 6