Last Updated:

Project structure in Android Studio

When we generate a new Android project using Android Studio (e.g. creating a simple Hello Android app), a lot of files and folders are automatically generated. Let's look at each of the main components and directories of the newly created project:

Project structure in Android Studio

This is how the empty, newly generated Android project in Android Studio looks like.

As you can see from the picture, the Android project is represented by 2 root folders: app and Gradle Scripts. The app folder includes 3 subfolders:

  1. the manifests folder contains configuration files or application manifest files
  2. The java folder contains the source code of the application.
  3. The res folder contains files of resources used in the Android application (images, styles, dimensions for various devices, etc.)

And now more about each folder:

What is the AndroidManifest.xml file

The file is one of the most important in an Android project. It contains information about app packages, components of type , (and other components not yet familiar to us, which I'll cover in future articles).
The file performs the following tasks:
AndroidManifest.xmlActivityService AndroidManifest.xml

  • Grants permissions to an app to use or access other system components.
  • Specifies how Activity will be launched, for example (which filters to use).

Java folder in Android project

The java folder contains the source code of the application. Classes can be located in different packages, but always inside the java folder.

Why do I need the res folder?

The res folder contains all the resources used by the application, including images, various xml files, animations, sound files and many others. Within the res folder, these are all resources distributed in their own folders:

  • The folder contains files with images that will be used in the application.drawable
  • The folder contains xml files that are used to build the user interface of the Android application.layout
  • The folder contains xml files that are used only to create menus.menu
  • Only application icons are stored in the folder. Any other items should be placed in their own folder.mipmapdrawable
  • values stores those xml files that define simple values such as strings, arrays, integers, dimensions, colors and styles.

Gradle Scripts in Android Studio

Gradle scripts are used to automate the build of a project. Android Studio builds the app in the background without any intervention from the developer. This build process is carried out using the Gradle system, a toolkit for automatic assembly using a set of configuration files. Gradle scripts are written in .groove

.idea folder

 

The .idea folder is not visible in the picture, but if you select the Project Files tab, it appears. The Eclipse development environment uses the project.properties file to configure the project's metadata. In Android Studio deals with this folder. This means that the metadata of a particular project is stored in Android Studio..idea

Today we looked at the main components of the project structure in Android Studio.