2 minute read

3.4. Folder and File Structure of an Android Studio Project

file called “MainActivity.java” is the active tab in Section 2 therefore the middle pane in Section 3 shows the contents of this “MainActivity.java” file.

Section 4. This section is also controlled via tabs. The developer can switch project files, structures, captures and favourites for viewing in the left pane.

Advertisement

Section 5. The current or previous compilation, building or debugging processes are shown here. For the snapshot of Figure 3.6, it is indicated that the “Gradle build finished in 14 seconds”. Gradle is the build system of Android Studio. Therefore, the message says that the building engine completed its previous task in 14 seconds.

Section 6. This is the Run button of Android Studio. When we set up the user interface and write the Java code of a project, we click this button to make the Android Studio build the project (which means creating the executable file from project files) and then we can run it on an emulator or on a real device.

3.4. Folder and File Structure of an Android Studio Project

The file structure of an Android project can be viewed in various forms in Android Studio. The button just at above the left pane (shown by the arrow) is used to open the selection box for choosing the preferred method of viewing the file hierarchy as shown in Figure 3.7. The default file viewer is the “Android” mode which is the easiest way of grouping files and folders in my opinion. When the selection is the “Android” mode, the default files and folders shown in Figure 3.8 is shown in the left pane. You can use the arrows (shown inside the circle in the figure) for viewing the contents of folders.

The default folders (shown inside the rectangles in Figure 3.8) and their contents are explained as follows:

Figure 3.7. Switching among different ways of viewing files and folders

1. manifests folder: This folder has the AndroidManifest.xml file inside. This file contains the configuration parameters of the project such as permissions, services and additional libraries.

2. java folder: The source code files written in Java programming language reside in this folder. You can see that the java file of the activity named “MainActivity.java” is automatically created in this folder.

3. res folder: The resource files are contained in this folder. Resources basically mean all the needed files except the source code. For example, if we want to include an mp3 file in our project, we place this file inside the “res” folder.

This article is from: