How to define a preprocessing task for android build?

I’m currently playing with the new android gradle build system.

My problem is that the plugin only ‘exports’ assemble and build tasks but has many internal tasks, like e.g. those for Debug:

prepareDebugDependencies
compileDebugAidl UP-TO-DATE
generateDebugBuildConfig UP-TO-DATE
mergeDebugAssets UP-TO-DATE
compileDebugRenderscript UP-TO-DATE
mergeDebugResources UP-TO-DATE
processDebugManifest UP-TO-DATE
processDebugResources UP-TO-DATE
compileDebug UP-TO-DATE
dexDebug UP-TO-DATE
processDebugJavaRes UP-TO-DATE
validateDebugSigning
packageDebug UP-TO-DATE
assembleDebug UP-TO-DATE

Is it possible to somehow depend on those inner tasks ? I have a ‘generateAssets’ tasks that generates all graphic stuff etc.but with

assemble.dependsOn("generateMyAssets")

the task will be run as the last step of ‘assemble’. Ideally it should run before prepareDebugDependencies.

Hello Steve, all those “internal” tasks are created within the project.afterEvaluate closure which means that they can’t be referenced directly in the build.gradle. As a workaround you can move the dependsOn declaration in the afterEvaluate phase too.

project.afterEvaluate{
    prepareDebugDependencies.dependsOn("generateMyAssets")
}

This is a limitation of the current extension mechanism and will be adressed in some kind in the future.

cheers,

rene

Hi Rene,

thanks for the workaround !

I would like to mark this question as answered, but cannot find any button etc. on the page. Is it a restricted operation ?

Maybe you don’t have the permission to do that. I’m taking care of that.

cheers, René