Android build.gradle : Running a custom task before dependencies are generated -


in android project, have dependency on jar file generated different project uses ant build system. in build.gradle, using

ant.importbuild('otherprojectpath/build.xml') { anttargetname ->     'sc' + anttargetname } 

the ant target want call build. since appending 'sc' while importing, task names become scbuild. want when run gradlew assemble, first scbuild should run , copy generated jar file other project in project's libs folder , use jar while compiling.

so have created gradle task this

task buildoutputjar(dependson: ['scbuild']) {     copy{         'otherprojectpath/bin/output.jar'         'libs'     } } 

and in build.gradle have added

prebuild.dependson buildoutputjar 

my dependencies in build.gradle has line

compile filetree(dir: 'libs', include: ['*.jar']) 

now when run gradlew assemble first time, ant task run in other project, jar created , copied in project's libs folder while compiling project's file doesn't jar , gives compilation error. may because dependencies have been generated. when give gradlew assemble command second time, builds fine because jar there in libs folder. old jar copied when ran gradle command last time. each time use jar file generated last command. suggest how fix it?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -