Carl
Carl

Reputation: 250

android gradle copy task not work

I have a project structure as:

-main project
--subject a

in my subject a build.gradle add copy task

 task makeDebugJar(type: Copy) {
   def dist = new File("livenessLib/build/outputs","jars")
   if (!dist.exists()) {
    dist.mkdir()
   }
   println "++++++debug MyLib task invoke ++++++: "
   def sourcedir = new File("build/intermediates/bundles/debug/")
   if (sourcedir.exists()) {
       from(sourcedir) {
         include('classes.jar')
       }
      into(dist)
      println "++++++Copy doaane ++++++: "
      rename('classes.jar', 'ZALiveness-debug.jar')
      println "++++++rename done ++++++: "
  }
 }
 makeDebugJar.dependsOn build

then build main project ,the log show every step invoke,and dir jars was created,but no jar in this dir .

anyone can help me resolve this problem ? thanks very much

Upvotes: 0

Views: 786

Answers (1)

AlchemistLi
AlchemistLi

Reputation: 45

task copyFiles(type: Copy)

copyFiles {
    description = 'Copies html5 files from the common library...'
    from '../../www'
    into 'assets/www'
    include('**/*')
}

please see:

How to run copy task with android studio into assets folder

Upvotes: 1

Related Questions