Open In App

Android | Android Application File Structure

Last Updated : 05 Mar, 2021
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

It is very important to know about the basics of Android Studio’s file structure. In this article, some important files/folders, and their significance is explained for the easy understanding of the Android studio work environment.

In the below image, several important files are marked:
Android Studio

All of the files marked in the above image are explained below in brief:

  1. AndroidManifest.xml: Every project in Android includes a manifest file, which is AndroidManifest.xml, stored in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our application, its components, and its requirements.

    This file includes nodes for each of the Activities, Services, Content Providers and Broadcast Receiver that make the application and using Intent Filters and Permissions, determines how they co-ordinate with each other and other applications.

    A typical AndroidManifest.xml file looks like:




    <?xml version="1.0" encoding="utf-8"?>
    package="com.example.geeksforgeeks.geeksforgeeks">
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    </manifest>

    
    

  2. Java: The Java folder contains the Java source code files. These files are used as a controller for controlled UI (Layout file). It gets the data from the Layout file and after processing that data output will be shown in the UI layout. It works on the backend of an Android application.
  3. drawable: A Drawable folder contains resource type file (something that can be drawn). Drawables may take a variety of file like Bitmap (PNG, JPEG), Nine Patch, Vector (XML), Shape, Layers, States, Levels, and Scale.
  4. layout: A layout defines the visual structure for a user interface, such as the UI for an Android application. This folder stores Layout files that are written in XML language. You can add additional layout objects or widgets as child elements to gradually build a View hierarchy that defines your layout file.

    Below is a sample layout file:




    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="vertical" >
        <TextView android:id="@+id/text"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello, I am a TextView" />
        <Button android:id="@+id/button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Hello, I am a Button" />
    </LinearLayout>

    
    

  5. mipmap: Mipmap folder contains the Image Asset file that can be used in Android Studio application. You can generate the following icon types like Launcher icons, Action bar and tab icons, and Notification icons.
  6. colors.xml: colors.xml file contains color resources of the Android application. Different color values are identified by a unique name that can be used in the Android application program.

    Below is a sample colors.xml file:




    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="colorPrimary">#3F51B5</color>
        <color name="colorPrimaryDark">#303F9F</color>
        <color name="colorAccent">#FF4081</color>
    </resources>

    
    

  7. strings.xml: The strings.xml file contains string resources of the Android application. The different string value is identified by a unique name that can be used in the Android application program. This file also stores string array by using XML language.

    Below is a sample colors.xml file:




    <resources>
        <string name="app_name">GeeksforGeeks</string>
    </resources>

    
    

  8. styles.xml: The styles.xml file contains resources of the theme style in the Android application. This file is written in XML language.

    Below is a sample styles.xml file:




    <resources>
        <!-- Base application theme. -->
        <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
            <!-- Customize your theme here. -->
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
        </style>
    </resources>

    
    

  9. build.gradle(Module: app): This defines the module-specific build configurations. Here you can add dependencies what you need in your Android application.




    apply plugin: 'com.android.application'
    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "com.example.geeksforgeeks.geeksforgeeks"
            minSdkVersion 16
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:0.5'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
    }

    
    



Previous Article
Next Article

Similar Reads

Android Studio Project Structure VS Eclipse Project Structure
Eclipse is a standard package that is ideal for java and plug-in development, as well as introducing new plugins. Eclipse is mostly used for Java because it is basically developed in Java. One of the reasons Eclipse is well-known for its Java IDE is because of this. To personalize the environment, Eclipse includes its own workspace and a flexible p
4 min read
How to Convert a Kotlin Source File to a Java Source File in Android?
We use Android Studio to translate our Java code into Kotlin while transitioning from Java to Kotlin. But what if we need to convert a Kotlin file to its Java equivalent? We'll examine how to convert a Kotlin source file to a Java source file in this blog. Let's get this party started. Because of its interoperability with Java, Kotlin grew at an ex
2 min read
How to Add OpenCV library into Android Application using Android Studio?
OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today’s systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human. When it integrated with various libraries,
3 min read
How to Open a URL in Android's Web Browser in an Android Application?
It might be essential to launch a browser separately while using an Android application to access a URL. Any action made on Views using Action Listeners has the potential to initiate the task of accessing a URL. In this article, we will learn about How we can Open a URL in Android's Web Browser from an Android Application. For this article, we will
2 min read
Android | How to add Radio Buttons in an Android Application?
Android radio button is a widget that can have more than one option to choose from. The user can choose only one option at a time. Each option here refers to a radio button and all the options for the topic are together referred to as Radio Group. Hence, Radio Buttons are used inside a RadioGroup. Pre-requisites: Android App Development Fundamental
6 min read
How to Add Resource File in Existing Android Project in Android Studio?
Android resource file is a file that stores resources needed for the UI part of an android application. Like: Layout files, drawable files, etc. In the android application, it is very often that we need another resource file for another purpose in the existing application. There are many types of resource files Layout files, Drawables, Menus are so
1 min read
Android Manifest File in Android
Every project in Android includes a Manifest XML file, which is AndroidManifest.xml, located in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our application, its components, and its requirements. This file includes nodes for each of the Activities, Se
5 min read
How to convert CSV File to PDF File using Python?
In this article, we will learn how to do Conversion of CSV to PDF file format. This simple task can be easily done using two Steps : Firstly, We convert our CSV file to HTML using the PandasIn the Second Step, we use PDFkit Python API to convert our HTML file to the PDF file format. Approach: 1. Converting CSV file to HTML using Pandas Framework. P
3 min read
How to Create the Virus File that Deletes the IMP File of the Operating System?
The virus that we are going to create in this article will delete all the Mandatory files of the Operating System (OS). Also as the virus activates it will also wipe out all the files in the system whenever the victim's PC restarts. Now to create the virus follow the below steps: Step 1: Press the Window + R Button from the Keyboard. This will open
2 min read
How to Make a Phone Call From an Android Application?
In this article, you will make a basic android application that can be used to call some numbers through your android application. You can do so with the help of Intent with action as ACTION_CALL. Basically Intent is a simple message object that is used to communicate between android components such as activities, content providers, broadcast recei
4 min read
How to Build a ChatGPT Like Image Generator Application in Android?
Chat GPT is nowadays one of the famous AI tools which are like a chatbot. This chatbot answers all the queries which are sent to it. In this article, we will be building a simple ChatGPT-like android application in which we will be able to ask any question and from that question, we will be able to get an appropriate response in the form of images
5 min read
How to Filter Logcat to Only Get Messages From the Running Application in Android?
In Android Studio Logcat is a window to display messages, Logcat shows real-time messages and keeps history for the future. To see the messages of users' own interests users can filter Logcat cat. The default filter is set to log output related to recent ran apps only. To view Logcat follow these steps View > Tool Windows > Logcat To Filter L
1 min read
How to Build a TODO Android Application with AWS DynamoDB as Database?
This is a TODO application made on android studio IDE, code is written in JAVA, and data store in AWS DynamoDB and fetch to the home screen. The connection established between the application and AWS through Amplify CLI and the data is successful gets stored by creating a TODO Table in DynamoDB, a Schema is also created which shows the structure of
7 min read
How to Send an Email From an Android Application?
In this article, you will make a basic Android Application that can be used to send email through your android application. You can do so with the help of Intent with action as ACTION_SEND with extra fields: email id to which you want to send mail,the subject of the email andbody of the email.Basically Intent is a simple message object that is used
4 min read
Creating a Safety Net Checker Application in Android
In this tutorial we will build a SafetyNet checking application which will help us to understand how exactly does Google's Safetynet Attestation API Functions and also understand JWS resolving in Kotlin to objects, generating a nonce and passing them during API call. Moreover, understanding Safetynet is necessary for every Android App developer bec
8 min read
How to Share a Captured Image to Another Application in Android?
Pre-requisite: How to open a Camera through Intent and capture an image In this article, we will try to send the captured image (from this article) to other apps using Android Studio. Approach: The image captured gets stored on the external storage. Hence we need to request permission to access the files from the user. So take permission to access
6 min read
How to Add Widget of an Android Application?
It's known that many of the android apps that have installed on the phone contain widgets. The most common examples are the Calendar and the Clock widget. So what are these Widgets? Widgets are just a mini-app that lives on the home screen and apart from small launcher icons that normally appear on the home screen. Widgets do take up more space and
8 min read
Designing the Landscape and Portrait Mode of Application in Android
Whenever the user switch to landscape mode an issue is encountered in which some of the widgets becomes invisible (as you can see the below image) and so in this scenario there is a need to design the separate layout for the landscape mode. At the end of this article you will be able to do that. Step 1 : Create a new project in android studio : Ref
5 min read
Open Specific Settings Using Android Application
In android development, the phase comes where the app needs specific settings to be modified manually by the user. So at that time developer directs the user to open specific settings and modify them. So in this article, it has been discussed how to open specific settings and make the user change them easily. Step 1: Create a new Empty Activity and
3 min read
Processes and Application Lifecycle in Android
As an android developer, if one does not know the application lifecycle of android application or does not have in-depth knowledge about it, there are very high chances that the application will not have a good user experience. Not having proper knowledge of the application lifecycle will not affect the working of that application but it will lead
7 min read
How to Build an Application to Test Motion Sensors in Android?
In this article, we will be building a Motion Sensor Testing App Project using Java and XML in Android. The application will be using the hardware of the device to detect the movements. The components required to detect the motion are Accelerometer and Gyroscope. The Accelerometer is an electronic sensor used to detect the device's position in spac
6 min read
How to Create a Paint Application in Android?
We all have once used the MS-Paint in our childhood, and when the system was shifted from desks to our palms, we started doodling on Instagram Stories, Hike, WhatsApp, and many more such apps. But have you ever thought about how these functionalities were brought to life? So, In this article, we will be discussing the basic approach used by such ap
12 min read
How to Get Saved Contacts in Android Application using Cursor?
Phone Contacts are very important source of data for everyone and hence accessing phone contacts is the main feature for many applications like Truecaller to help their users and provide them a better experience. We all have a default application in our mobile to manage contacts but what happens if we will create our own application that will read
3 min read
How to Build a Xylophone Application in Android?
In this article, we will be building a project on Xylophone using Java and XML in android. Xylophone originally is an instrument played by striking a row of wooden bars. This application will be implementing a Xylophone-like instrument that is capable of producing sounds. We will create few Buttons in this app that will act as keys of the instrumen
4 min read
How to Reduce Battery Usage in Android Application?
The battery life of an Android phone is dependent on many factors, a few of them are, screen brightness, fast processors, apps running in the background, thin bodies, and many more. Being an app developer, all hardware constraints are out of one’s hands and cannot be changed. What an app developer can do is, make changes in the app such that it req
4 min read
How to Build a Step Counting Application in Android Studio?
Many of us have used the step counter on our phones while we go for walk or run. It counts the total steps that the user has walked and displays it on the screen. The other name for the step counter is a pedometer. But have you ever thought about how can an app count our steps? What is the coding behind the working of this app? Let's find the answe
6 min read
How to Check if Application is Installed in Your Android Phone and Open the App?
In this article, we are going to check if a particular app is installed on our phones or not. If yes then we will be having an option to open the app. Else it will show a toast message saying Not available. So here we are going to learn how to implement that feature. Note that we are going to implement this project using the Java language. Step by
3 min read
Encryption and Decryption Application in Android using Caesar Cipher Algorithm
Here, we are going to make an application of “Encryption-decryption”. By making this application we will be able to learn that how we can convert a normal text to ciphertext and encrypt our message. We will also be decrypting our message with help of a key by again converting it to a readable form. This article will help you to introduce basic conc
7 min read
Android Package Name vs Application ID
As an Android Developer, you should know that the Package Name that you choose for your app is very important. We are referring to the Package Name of the application which we declare in the Manifest.xml rather than the Java package name (although they will be identical). But there is a difference between the Package Name and the Application ID. In
3 min read
How to Create Multiple APK Files For Android Application?
In Android, making a single apk compatible with all devices, increases the apk size, as it has resources for every device. Why make our users download apk that contain device-specific useless resources who are having lower memory devices. Now we got the solution i.e. creating multiple apks from the same application or apk for a specific device. Gen
3 min read
three90RightbarBannerImg