Android Studio’s Project Structure & Build System Explained
Are you trying to learn android development or already are an android developer but getting confused by the different project structures between Eclipse and Android Studio or the Gradle build system? Or even failing to understand what is Gradle all about? This article is surely for you. Here’s a quick solution to your confusion.
TOP LEVEL FOLDERS OF ANDROID STUDIO
1) Main Project: This would be entire project context.
2) .idea: This where project specific metadata(data about data) is stored by Android Studio
3) Project Module: The “Actual Project”*.
4) Gradle: This is where the gradle system’s build jar(Java Archive) wrapper i.e. this jar is how Android Studio communicates with gradle installed in operating system.
But now the main question arises, what is Gradle?
Gradle is a project customization tool that builds upon the concept of Apache ANT & Apache Maven and introduces a ‘Groovy’ based domain specific language instead of most traditional XML form of declaring the project configuration. Gradle uses the direct acyclic graph (“DAG”) to determine which tasks can be run.
Here are some key points of Gradle:
- Its cross platform
- The initial plugin focuses on Java, Groovy and Scala (All 3 are programming languages).
5) External libraries: This is not actually a folder but a place where referenced libraries are shown. Here’s where the targeted platform is shown etc.
*ACTUAL PROJECT:
1) Build: This has all the complete output of the make process i.e. classes.dex, compiled classes and resources.
In Android Studio GUI, only a few folders are shown. The important part is that your R.java is found here under build/source/<flavor>/R/<build type(optional)>/package/R.java
Now, lets see how APK files are made!
To make an APK file, a program for Android is first compiled, and then all of its parts are packed into one file. This holds all of that program’s code(The are the .dex files), resources, assets, certificates and manifest files.
Programs are commonly written in Java & compiled to bytecode. They are then converted from Java Virtual Machine compatible .class files to Dalvik compatible .dex(Dalvik Executable) files before installation on device. The compact Dalvik Executable format is designed to be suitable for systems that are constrained in.
2) libs: This is the standard library folder.
3) src: Here, you only see the ‘java’ and ‘res’ folder which corresponds to the src and res of Eclipse Android Development Environment.
Are you an Android Developer? Join Truelancer today and start your Freelance Earnings.
I am a “Technical Entrepreneur” having more than 5+ years of experience in the design and development of mobile, web, wearables and desktop apps. I have also worked with Microsoft and Google. I love teaching and have delivered many App development workshops across India.