Android Studio Project Structure
Android Studio Project Structure
Hey Fellas I am right back for one more blog on Android
Development for Beginners.
As I said it in the previously, in this blog we’ll see the
Android Project Structure, how it is arranged and so on.
Android application development is never been easy due to its
raw nature and rapid growth and changes to platform. Earlier Eclipse was the
only IDE used for android development. Eclipse is developed and maintained by
open source alliance. But Nowadays we have a variety of IDE’s in the market for
Android Development.
By the launch of Android Studio on 15th may 2013,
Android development looks promising with the introduction of Android Studio
IDE. Android Studio is an IDE based on IntelliJ IDEA that is used for android
application development. This tool has more option that will enable developers
to speed up application development.
Gradle Based Build System:
1. Android Studio is an IDE based on IntelliJ
IDEA that uses gradle build system. In eclipse, you can create only one build
at a time. Which means, first create debug build and later you can create a
release build by signing with your keystore.
2. Android Studio projects are setup to build
both a debug and a release version of the application. The debug version is
signed with the developer key store key which is created automatically (Same as
eclipse debug builds). The release is not signed during the build; this needs
to happen after.
3. Android Studio, make it easy to create
several variants of an application, either for multi-APK distribution or for
different flavours of an application. This means, you can have different builds
for debug, release or may be different variant build from the same code.
4. Eclipse ADT plugin, always generate single
R.java file but, Android Studio supports multiple. The generated R.java is
located in the debug folder. You can change your build variant between debug
and release and accordingly it will create the R.java file in selected debug or
release directory.
Android Studio Project Structure:
A project in
Android Studio contains everything that defines your workspace for an app, from
source code and assets, to test code and build configurations. When you start a
new project, Android Studio creates the necessary structure for all your files
and makes them visible in the Project window on the left side of the IDE.
By default,
Android Studio displays your project files in the Android view.
This view does not reflect the actual file hierarchy on disk, but is organized
by modules and file types to simplify navigation between key source files of
your project, hiding certain files or directories that are not commonly used.
To see the actual file structure of the
project including all files hidden from the Android view, select Project from the drop down at the top of the Project window.
When you select Project view, you can see a lot more files and
directories. The most important of which are the following:
1.
Main Project
This would be entire project context.
Whatever you do in IntelliJ IDEA, you do that in the context of a project. A
project is an organizational unit that represents a complete software solution.
A project in Android Studio is like a workspace in Eclipse. In android Studio a
project, can contain multiple modules. A module in Android Studio is like a
project in Eclipse. In the above screenshot “HelloWorld” is the name of my
project
This means that, in theory it is
possible to build multiple apps with in the same project. From my personal
experience, creating multiple apps with in the same project doesn’t works well.
So, I recommend not to make your hands dirty trying the same thing. Instead, it
is a better idea to create single app per single project.
2.
.idea
Eclipse uses project.
Properties file for project specific metadata. Here in android studio, this
.idea does the same thing. This means the project specific metadata is stored
by Android Studio.
3. Project Module (app)
This is the actual project folder where
your application code resides. The application folder has following sub
directories
a.) build: This has all the complete output of
the make process i.e. classes.dex, compiled classes and resources, etc.
In the
Android Studio GUI, only a few folders are shown. The important part is that
your R.java is found here under build/source/r/<build
variant>/<package>/R.java
b.) libs: This
is a commonly seen folder in eclipse land too, which optionally can hold the libraries
or .jar files.
c.) src: The src folder can have both
application code and android unit test script. You will find two folders named
“androidTest” and “main” correspond to src folder. The main folder contains two sub folders java and res. The java folder contains all the java codes and res
contains drawables, layouts, etc.
4. gradle:
This is where the gradle build
system’s jar wrapper i.e. this jar is how AS communicates with gradle installed
in Windows.
5. External Libraries:
This is not actually a folder but
a place where Referenced Libraries and information on targeted platform SDK is
shown.
So in this blog we have gone
through the Project Structure of Android Studio. In the next blog we will see
how to install android studio.
If you like this blog do subscribe
and share, till then stay tuned.
The blog gave me idea about android studio project structure my sincere thanks for sharing this post and please continue to share this kind post
ReplyDeleteAndroid Training in Chennai
really you have posted an informative blog it will be really helpful to many peoples. so keep on sharing such kind of an informative blog. before i read this blog i didn't have any knowledge. so thank you for sharing this blog.
ReplyDeleteAndroid Training in Chennai
I have read your blog and i got a very useful and knowledgeable information from your blog.You have done a great job . If anyone want Android Training in Bangalore , Please visit our pageAndroid Training in Bangalore
ReplyDeleteIt is really a great work and the way in which u r sharing the knowledge is excellent.Thanks for helping me to understand basic concepts. As a beginner in android programming your post help me a lot.
ReplyDeleteAndroid Training in Chennai
Interesting blog post. This blog shows that you have a great future as a content writer. Waiting for more updates...
ReplyDeleteJava Training in Chennai | RPA Training in Chennai
Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal.
ReplyDeletenebosh course in chennai