

#Android studio build apk always debug code
Generated code is dummy, to keep all the methods in the. Assembled that is two DEX files, almost three. In all variants application module is called “app”, while library modules are called “app2”, “app3” and so on.Įach variant has in total around 100 packages 15,000 classes 90,000 methods. All modules have a dependency on Butterknife, to make project a bit more “alive”, since all projects has external dependencies.
#Android studio build apk always debug android
Minimal Android SDK is 15, that covers most of the devices according to API level dashboard. That leads to the following hypothesis: “The Incremental build time for a project with multiple modules is faster than for a single-module project, because only modified modules are recompiled.”Īll right, lets find out whether this is true! Experiment Setup It also doesn’t rebuild a module if it wasn’t changed. We all know, that Gradle runs task in consequent builds only if input isn’t the same. The merging resources and processing manifest phase can also sometimes be time-consuming, but if the Java code is untouched, than incremental build is quite fast. For a project with a single module, those were the compiling and postprocessing phases.

It’s difficult to speed up all the phases in one experiment, so I decided to focus on the longest ones. APK.Īs I mentioned, our goal is to minimize incremental build time. For libraries this stage means creating an. Most important ones are: transformClassesWithMultidexlist and transformClassesWithDex. All Gradle tasks with a “transform” prefix are part of this phase. If you are using AspectJ, weaving also happens here. Then source code is compiled into byte code. This phase started with Annotation Processors, in case you use them. After this phase resources and Manifest are ready to be packaged in the result file. Merging resources and processing Manifest.If this module depends on another one, that module would be built as well. During this phase Gradle check that all libraries this module depends on are ready. AAR has some Android-related things, for example, resources and Manifest.īuilding process for any library or application module can be roughly split into five phases, that could be represented with a certain Gradle tasks:

It is the module that applied the Gradle library plugin: apply plugin: ''Īs a result of publishing such a module you will get an. One application module cannot depend on another. When you create an Android application you have to have at least one application module, it is a module that applied the Gradle application plugin in his adle file: apply plugin: ''Īs a result of building this module you will get an. This article will explore the results I collected and my findings.īefore we dive into my experiment, I’d like to talk about the theory behind all this, and explain how we can decrease incremental build time. But first, I decided to create an experiment and collect some data, so I could make a better-informed decision. I was tempted to just split our codebase by feature, by layer, or in some other quick and obvious way. Splitting an application into modules could be a solution to this problem. This not only wastes precious developer time - it also makes test-driven development extremely tedious, which hurts overall code quality. More code means not only longer build times - it means longer incremental build time.įor teams with big projects, waiting for new builds could eventually take up 10-15% of their workday. By Nikita Kozlov How modularization can speed up your Android app’s built timeĭevelopers will continue to add new features throughout an application’s lifetime.
