Master_T
Master_T

Reputation: 7987

Android project and Gradle: assemble a single module

I have an Android Studio project that contains several sub-projects (aka: modules). I would like to build some of these sub-projects from the command line.

I read on the Android dev guide that you can build your project by simply running

gradlew.bat assembleDebug

from the command line, however this always builds the entire project (all the modules) I just want to assemble a single module, how do I do that?

Upvotes: 9

Views: 7929

Answers (2)

Leo Landau
Leo Landau

Reputation: 1795

Another way to do this is:

gradlew.bat :myModule:assembleDebug

https://stackoverflow.com/a/16987319/1807627

Upvotes: 19

laalto
laalto

Reputation: 152907

gradlew.bat assembleDebug -a -b path/to/module/build.gradle

-a only builds the component and does not rebuild its dependencies

Use -b to specify another Gradle build file. In this case, the module's instead of the top-level build.gradle.

If you weren't using the Gradle wrapper, you could alternatively just cd to the module directory and run gradle assembleDebug -a there.

Upvotes: 9

Related Questions