You need to add this res folder for your sourceset. You should be able to do
android.applicationsVariants.all { variant -> android.sourceSets.get(variant.name ).res.srcDir('path/to/generated/res/folder') } On Tue, Jan 6, 2015 at 1:02 AM, Patrick Boos <patrickboo...@gmail.com> wrote: > Thank you Xavier for this great solution! Now a follow up question that > should be easy to answer I hope. How can I actually get those generated > files into the built .apk? We are generating pngs from svgs that we put > into "build/generated/res/svg/${variant.dirName}/drawable-[x]{0,3}hdpi/" > folders. But they do not get picked up automatically as we guessed. How can > we get them picked up? > > Thanks a lot. > > On Tuesday, December 2, 2014 8:34:52 PM UTC+1, Xavier Ducrohet wrote: >> >> You should use: >> >> "/build/generated/res/something/${variant.dirName}/xml/" >> >> dirName will ensure that the folder (and subfolders) is unique. There is >> nothing to handle "something" though, so make sure you put something unique. >> >> Our scheme is res/<task or type>/variant.dirName/ >> >> where <task or type> depend on what the folder is for. "rs" stands for >> renderscript. This will be the res folder where the renderscript task drops >> its .bc file which is the compiled renderscript code. >> >> On Fri, Nov 28, 2014 at 8:06 AM, Pierre Degand <pierre...@gmail.com> >> wrote: >> >>> Hi, >>> >>> I would like to generate some files at build time (an XML file and then >>> add a reference to this XML into the Manifest of my app). >>> >>> I suppose the /build/generated/ folder is the place to put this kind of >>> generated files. >>> >>> After studying how this folder works, with the `wearApp(':wear')` >>> dependency, I learned that I should put my generated XML file into >>> /build/generated/res/something/rs/flavorA/release/xml/ >>> >>> >>> but I don't want to hard code this path into my build script. Is there a >>> way to retrieve this path dynamically, based on the current variant for >>> example, without having to do something like >>> "/build/generated/res/something/${variant.flavor}/${ >>> variant.buildType}/xml/" >>> >>> >>> On a more generic side, how is the "something" part of the path used >>> during the resource merging ? And why is there a "rs" part in the path ? >>> >>> Thank you very much for the explanations. >>> >>> Pierre D. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "adt-dev" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to adt-dev+u...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Xavier Ducrohet >> Android SDK Tech Lead >> Google Inc. >> http://developer.android.com | http://tools.android.com >> >> Please do not send me questions directly. Thanks! >> > -- > You received this message because you are subscribed to the Google Groups > "adt-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to adt-dev+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Xavier Ducrohet Android SDK Tech Lead Google Inc. http://developer.android.com | http://tools.android.com Please do not send me questions directly. Thanks! -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.