Trying to add dependency to Android processResources

I’m trying to run a script to generate my strings.xml files just before the resource files are processed. I’ve seen the answer to this question:

But I get the error: Could not find property ‘processResources’ on

This is what I’ve got:

task generateLocalizedStrings(type:Exec) {

workingDir ‘…/…/…/localization/’

commandLine ‘python’, ‘


project.afterEvaluate {



I’ve also tried:

applicationVariants.all { variant ->



The second way is the way that the Gradle user guide ( Tells you to do it.

However, it appears that part of the guide is broken as of the 1.0 release. In particular, we had to do

variant.outputs[0].process… to make it work.

I have no clue why their are multiple outputs, or what may be missed if you only do it on [0]. Regardless, the docs are apparently out of date for the current release. The correct place to report (or discuss) that would be over at the adt-dev list (!forum/adt-dev)

As a side note: The Gradle user guide is the documentation for Gradle in general. The documentation page you are pointing out is the documentation of the Gradle Android plugin.

My bad, I was meaning to copy the (less than ideal) name from the android docs, which is “Gradle Plugin User Guide”

Thanks for the help! I actually went with

applicationVariants.all { variant ->

variant.outputs.each { output ->