App File Structure



You have tested your hands on a Hello World App. Though in the HelloWorld app, Android Studio has done all the boilerplate coding for us. Let us take a deep dive into the project structure and see how the files are segregated in our project.

Broadly there are four major components in an Android app development project. If you navigate to Android view in the navigation panel, you will see:

Application
	manifests
	  AndroidManifest.xml
	Java
	  Main
	    *.java files
	  Test
	    *.java Test files
	res
	  drawable
	    image files
	  layout
	    *.xml
	  mipmap
	    launcher icon files
	    ...
	  values
	    color.xml
	    string.xml
	    style.xml
	    ...
	  Module Level Gradle file
	Project Level Gradle File

Android Studio Create New Project

AndroidManifest.xml is the root of the android application, this has the details of the application. If your app needs to access any of the resources of the device, you have to ask for permissions via this file. If you have multiple activities, then also you need to update this file for same. Startup activity, services, listeners are to defined in this file.

After manifests folder, it has Java folder which has java code for main functionalities of application and also for unit testing of the application. In the main folder under java folder, the complete business logic of the application is present.

Then there is a res (resources) folder; it has all the UI related components of the application. There is a drawable folder which holds images of different resolution nested in it. Then there is layout folder which has layouts of all activities, fragments, and any other design related XML files.

The res folder also has mipmap folder which has images for launcher icon in different resolutions. And also there is values folder which has XML files for string variables, color named variables, style or theme of application and other constant values used for designing of application.

Apart from all these, there are two kinds of Gradle files in which one is module level build, and other is application level build file.

If the application has some functionality like connecting to firebase or recycler view or posting data to a remote server using volley; then you need to call those dependencies in this module level Gradle build file.

If there is some configuration which is common to all modules of the application; then you need to define it in app level or top level Gradle file.

This way an Android application stores files which cumulatively serve the purpose of an application. Knowledge of the directory structure also gives you a standard for developing applications for the Android operating system which makes it easy to understand for other developers who might maintain your app or enhance it.