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?
gradle files in an Android Studio project? Save this question.
assemble will build your artifacts, and build will assemble your artifacts with additional checks. build depends on assemble , so build is sort of a superset of assemble. You can have a look on the tasks that will be executed by using the --dry-run flag. e.g.
Another way to do this is:
gradlew.bat :myModule:assembleDebug
https://stackoverflow.com/a/16987319/1807627
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With