Folder Structure
Closed this issue · 4 comments
Question: This is the first time I've seen a three directory structure. Do classes in the same package in the debug folder not get built as a part of a release build (like how there's a Modules.java in both debug and release)? Is that a feature of gradle?
Not an issue, more of a question, but Github would let me tag it as a question. :\
Thanks!
src/
- debug/ <-- only added for 'debug' build type
- main/ <-- shared for all build type
- release/ <-- only added for 'release' build type
There are two build types of this app: debug and release. When Gradle builds the 'debug' type it combines both the src/debug/java/
and src/main/java/
folders when running the Java compiler. For the 'release' type it does the src/release/java/
and src/main/java/
folders.
Since the Modules.java
file appears in src/debug/java/
and src/release/java/
only one is present in the final APK for 'debug' and 'release'. This allows me to change the configuration of the app based on which type you are building (and therefore running).
You can read more here: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Types
Worth noting that 'debug' and 'release' types are added automatically by the Android Gradle plugin. You can add additional ones yourself. For example, at Square we have 'debug', 'dogfood', and 'release' which allows us to customize the app into three different configurations for three different audiences.
Interesting, I must have created my project with an older version of Android Studio, it only produced main. Thanks for the quick response!
main is the only folder created by default
On Fri, Feb 28, 2014 at 1:26 PM, Prashanth Sadasivan <
notifications@github.com> wrote:
Interesting, I must have created my project with an older version of
Android Studio, it only produced main. Thanks for the quick response!Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36396071
.