Android project structure and Hello World!

This lesson will cover Android project structure, main project files and folders.

We’ll cover the following

  • Structure
  • Project files
  • Module files
  • Hello World!


Let’s take a look at the structure of what a typical Android project looks like.

  • app – root module folder
    • build.gradle – module config file
    • src/main/AndroidManifest.xml – module manifest file
    • src/main/java – module source folder for Java or Kotlin files
    • src/main/res – module resource folder
  • build.gradle – project config file
  • gradle,, gradlew, gradlew.bat – Gradle related files for to build android project
  • settings.gradle – project settings file

The android project may consist of one or several modules. Small to medium projects usually have one module, while large projects tend to have multiple modules. Each module may contain a separate feature or common logic. The definition and composition of modules will be explained in detail later in the lesson.

Project files usually apply some configuration to every module, which is part of this project. Module files usually contain our source code and resources.

Project files

The settings.gradle file is a project file which contains the list of modules and project name. In our case module name is app and the project name is ‘MyApplication1. = "MyApplication1"
include ':app'


The file defines settings to configure a build environment.

The gradle, gradlew, gradlew.bat – files related to Gradle wrapper. This means that we don’t have to manually install Gradle ourselves.

Finally, build.gradle file is a top-level build file where we can add configuration options common to all modules. In our case we want all of our modules to have access to Google’s Maven repository and Bintray’s JCenter repository for dependencies. These repositories allow projects to use some core Android functionalities.

Module files

Every module has a unique name, in our case module is called app. That’s where we put application source code.

The module build.gradle file contains a set of configurations related to this module only, such as:

  • compileSdkVersion – the version of Android SDK to compile the project
  • minSdkVersion – the minimal supported Android version
  • targetSdkVersion – the target version of Android SDK, used to tell the system to enable compatibility behaviours
  • applicationId – unique identifier of the application on the device and in Google Play Store
  • versionCode – an internal version number
  • versionName – the version name displayed to users
  • compileOptions – compile options to achieve some features of Java 1.8
  • dependencies – first-party and third-party library dependencies, discussed in the next lessons
plugins {
    id ''

android {
    compileSdk 31

    defaultConfig {
        applicationId "in.codingtimes.myapplication1"
        minSdk 19
        targetSdk 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), ''
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation ''
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

The AndroidManifest.xml is the place where we declare all main components used in our application, such as activities, services, permissions, etc.

Our manifest file currently contains the following:

  • package – the package name of the application, in our case in.codingtimes.myapplication1
  • theme – the global application theme, in our case Theme.MyApplication1 theme
  • label – the label which is used as a value for the application icon
  • activity – the activity, we currently only have one MainActivity
  • intent-filter – the set of options used to give the activity some unique behaviour, in our case we declare that it’s the main activity which should be launched when user click on the application icon from the launcher

All resource-related files must be placed inside one of the predefined, sub-folders of src/main/res folder. One of such pre-defined folders is the layout folder, which contains all of our layout files. The other is the values folder, which usually contains some colors, styles, dimensions, etc.

For now, we only have one layout file, activity_main.xml, which describes layout structure. We are going to talk about it in more detail in the next lesson.

Finally, we have a src/main/java folder, which contains Java source code divided by packages.

Currently, we only have one class file MainActivity which represents our main screen. We will talk about it in more detail in the next lesson.

Hello World!

Hit the run button and wait until the Android application is compiled and the emulator is started. The first time it may take up to 3 minutes to build the project, but all consecutive builds will be much faster.

After you see the BUILD SUCCESSFUL message in the terminal window, switch to the Output tab to see the Android emulator and the launched application. Try to spend some time playing with the emulator.

In case you make some changes to the code, save your changes and press run again to restart the application. Please note, it might take some time so you can observe the terminal tab to get an idea of the progress.

That’s it!
You have successfully completed the post. Do Share : )

Peace Out!

Also Read – Install latest Android Studio on Windows and Linux

Check Out Deals on -> Amazon , Flipkart , Myntra , Adidas , Apple TV , Boat , Canva , Beardo , Coursera , Cleartrip , Fiverr , MamaEarth , Swiggy


Leave a Reply

Your email address will not be published.