Android project and Gradle: build one module

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

I read in the Android dev manual that you can create your project just by running

gradlew.bat assembleDebug 

from the command line, however this always creates the whole project (all modules) I just want to assemble one module, how can I do this?

+6
source share
2 answers
 gradlew.bat assembleDebug -a -b path/to/module/build.gradle 

-a only creates a component and does not restore its dependencies

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

If you did not use the Gradle shell, you could just simply cd into the module directory and run gradle assembleDebug -a .

+7
source

Another way to do this:

 gradlew.bat :myModule:assembleDebug 

fooobar.com/questions/70008 / ...

+9
source

Source: https://habr.com/ru/post/987568/


All Articles