Android studio project structure

A project in Android Studio contains everything that is required by an app, from source code and assets, to test code and build configurations, to apk generation.

Application Module

Application Module is a collection of source files and build settings. A android studio project can have one or application Module and one module may use another module as a dependency. Each module can be independently built, tested, and debugged.

Android app module provides a container for your app's source code, resource files, as well as app level settings such as the module-level build file and Android Manifest file. When you create a new project, the default module name is "app".

We can create a new module from File > New module. In the Create New Module window, Android Studio offers the following app modules:

  • Phone & Tablet Module
  • Android Wear Module
  • Android TV Module
  • Glass Module

Library module

A library module is the same as an app module, but when built, it creates a code archive file instead of an APK, so it can't be installed on a device.

In Android Studio we can create 2 type of library modules...

  • Android Library: This type of library can contain all file types supported in an Android project, including source code, resources, and manifest files. The build result is an Android Archive (AAR) file that you can add as a dependency for your Android app modules.
  • Java Library: This type of library can contain only Java source files. The build result is an Java Archive (JAR) file that you can add as a dependency for your Andriod app modules or other Java projects.

Project Files

manifests: Contains the AndroidManifest.xml file.

java: Contains the Java source code files, separated by package names, including JUnit test code.

res: Contains all non-code resources, such as XML layouts, UI strings, and bitmap images, divided into corresponding sub-directories

res directory structure

Directory Resource type
animator/ XML files that define property animations.
anim/ XML files that define tween animations. XML files that define tween animations.
color/ XML files that define a state list of colors.
drawable/ Bitmap files (.png, .9.png, .jpg, .gif) or XML files that are compiled into the following drawable resource subtypes:
  • Bitmap files
  • Nine-Patches (re-sizable bitmaps)
  • State lists
  • Shapes
  • Animation drawables
mipmap/ Drawable files for different launcher icon densities.
layout/ XML files that define a user interface layout.
menu/ XML files that define application menus, such as an Options Menu, Context Menu, or Sub Menu.
raw/ Arbitrary files to save in their raw form. To open these resources with a raw InputStream, call Resources.openRawResource() with the resource ID, which is R.raw.filename.
values/ XML files that contain simple values, such as strings, integers, and colors.
  • arrays.xml for resource arrays (typed arrays).
  • colors.xml for color values
  • dimens.xml for dimension values.
  • strings.xml for string values.
  • styles.xml for styles.
xml/ Arbitrary XML files that can be read at runtime by calling Resources.getXML()

Share & Like

Tutorial topics

About is for Java, J2ee, Html5 and android developers. All tutorials are well explained and are easy to understand. We have tested every tutorials on our developement environment before posting it in public domain.