9

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?

2 Answers 2

19

Another way to do this is:

gradlew.bat :myModule:assembleDebug 

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

Sign up to request clarification or add additional context in comments.

Comments

9
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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.