I have mutiple modules in my android project. if i make a release apk with :app:assembleRelease
it works but when i make a release apk with assembleRelease
it keep showing error. I know there's error in my code but this is not what i am questioning about. I just want to know what is the difference between assembleRelease
and :app:assembleRelease
In Multi module Gradle project, if you don't refer to your module explicitly then Gradle by default try to find that task from root project's Tasks graph.
For example: If you're having multiple modules named as module1 & module2, then on evaluation phase Gradle distributes each module's tasks in their own extensions. Meaning you must now refer it as :module1:task1
& :module2:task2
This is the reason why assembleRelease
doesn't work & :app:assembleRelease
works.
You can check tasks graph by opening 'Gradle' window in Android Studio/IntelliJ IDEA.
If you look at the image below you can see Tasks node which have common tasks available at root project.
While there are other module related tasks can be found inside expanding it's own node.
Note that: In android you can have multiple modules but your default module is always abbreviated as app module while others are considered as library module which are abbreviated by name of that individual module like base, db, domain etc. from image above (You can't have multiple app module in same project I guess).
The difference between :app:assembleRelease
and assembleRelease
is that assembleRelease
executes the assembleRelease
task of each module while :app:assembleRelease
executes the assembleRelease
task in the app
module.
Obviously the task graph is populated correctly for both, it means that :app:assembleRelease
for Android depends on the assembleRelease
of the other modules used as dependencies in :app
.
:app:assembleRelease
instead of assembleRelease
? –
Amplification app
and you aren't manually manipulating the task graph, yes. –
Reynolds © 2022 - 2024 — McMap. All rights reserved.
:db:assembleRelease
instead of:app:assembleRelease
? – Amplification