Project Structure and Key files in the Android App Project

In the earlier tutorial we created an Android App Project using the Android Studio. In this video tutorial we look at the key files which are part of the Android Project.

We look at the Activity file, the layout file and also talk about the role of Gradle which helps build and deploy the App.

Android App Development Basics | Install Android Studio | Activities and Layouts

Key Concepts

  1. Activities
    We use Activity to define what the App does. Like when we click on a button what needs to happen can be defined using an Activity. It’s a class written in Kotlin.
  2. Layouts
    To define how a screen in your App will look like we use an XML file. A screen can have various elements like images, text etc.

We use Layouts to define the UI and Activities to define the behaviour. Similar to what we do with websites – HTML, CSS and Javascript.

Like if you need to add a button then we use Layout to specify its position on screen and Activity to add functionality.

We bundle all these files together and that’s what an App is.

What happens when you start an App ?

Sequence of events when you start an Android App

  1. When you start an Android App the main activity is called.
  2. This tells Android to use a particular Layout.
  3. The layout is displayed on the device.
  4. The user interacts with the layout.
  5. The activity responds to these interactions, and updates the display.

Why Kotlin ?
It’s preferred because of additional features and it’s concise nature.

Why Android Studio ?
It includes a set of code editors, UI tools and templates, which are all designed to make development easier and faster.
It also comes with Android SDK which is needed to develop Apps. It includes Android source code and also a compiler to compile the code you write to Android format.

Getting Started

Install Android Studio from

Build the App – follow the video

  1. Create a new project
  2. Select a project template – Choose the Empty Activity option.
  3. Configure the project – Specify the app name, package name and save location. Be careful with the version you select. We will discuss more on this in future blog, but you need to consider which versions of Android you want the app to be compatible with. If you specify that the app is only compatible with the very latest version of the SDK, you might find that it can’t be run on many devices.

That is it, your first app is ready. Congratulations !!

Tech Stack for Native Android Development

What is a Native Android App ?

When your App is built to run on Android devices only. The advantages of building a Native app includes high performance, access to native APIs and features and better user experience. The disadvantages may include longer development time, higher development costs and platform-specific development.

What Tools and Technologies can be used to build a Native Android App ?

For native Android development, you can use the following tools and technologies

  1. Java or Kotlin programming languages – Both Java and Kotlin are popular programming languages for Android development. While Java has been the traditional language for Android development, Kotlin is gaining popularity due to its concise syntax and modern features.
  2. Android Studio – Android Studio is the official Integrated Development Environment (IDE) for Android app development. It comes with a set of tools and features that simplify the development process and speed up app development.
  3. Android SDK – The Android SDK is a collection of software development tools and libraries required for building Android apps. It includes tools for developing, debugging, and testing Android apps.
  4. Android Jetpack – Android Jetpack is a set of libraries and tools that help developers build high-quality apps faster. It includes components for handling UI, background processing, navigation, and more.
  5. Firebase – Firebase is a mobile and web application development platform that provides a range of features and services to simplify the app development process, such as real-time databases, push notifications, authentication, and analytics.
  6. Third-party libraries – There are various third-party libraries and tools available for Android development that can help you add functionality to your app or speed up development. Some popular ones include Retrofit for network communication, Glide for image loading and caching, and Dagger for dependency injection.

These are some of the most commonly used tools and technologies for native Android development. You can use them to create high-quality and feature-rich Android apps.

Steps to create a Native Android App

Let’s look at the steps to create a simple Native Android App

  1. Set up your development environment: To develop native Android apps, you’ll need to download and install Android Studio, which is the official IDE for Android development. Android Studio comes with the Android SDK and all the necessary tools you need to build and test your app.
  2. Create a new Android project: After setting up your development environment, create a new Android project in Android Studio. This will generate a default app structure with a basic user interface.
  3. Design the user interface: Android Studio comes with a visual layout editor that allows you to drag and drop UI elements onto the screen and customize their properties. Use this editor to create the user interface for your app, and add functionality to the UI elements by writing code in Java or Kotlin.
  4. Write your app logic: Once you’ve designed the user interface, write the code that handles user interactions and performs the necessary tasks to make your app work. This might include retrieving data from a database or web service, processing user input, or manipulating media files.
  5. Test your app: After you’ve finished writing your app, test it on a physical Android device or an emulator to ensure that it works as expected. Android Studio comes with a built-in emulator that allows you to test your app on various Android versions and device configurations.
  6. Publish your app: Once you’ve tested your app and made any necessary changes, you can publish it on the Google Play Store, which is the official app store for Android. To publish your app, you’ll need to create a developer account, submit your app for review, and follow Google’s guidelines for app publishing.

Learn how to create different versions of your App like Free and Paid

Android framework makes it quite easy for you to generate different flavors and variants of your App. Like you can create a free version or a paid version of your App.

In order to do this you need to follow these steps:

You need to specify the variants or flavors in your App’s build.gradle file.


productFlavors {
    demo {
        applicationId "com.edocent.demo"
        versionName "1.0-demo"
    full {
        applicationId "com.edocent.full"
        versionName "1.0-full"

In all likelihood your Free App version will need a different Activity compared to the Paid one. So you need to create different folders for the two flavors.

So go to the Project->src folder and create a new Java Folder – free.

Create another one for paid similarly.

Add appropriate Activity and other files to this folder.

And you are all set. Execute Generate Signed APK task from the Build option. This will ask you which flavor you need the APK for.

Cool isn’t it.

Source code is available here

Learn how to generate a signed APK file

All Android Apps must be digitally signed before they are installed on a device.

This is required to verify identity of developer who published it. And also to verify if it has been tampered.

Follow the video to generate the signed APK file and also to learn how to automate the process.


Learn how to create and use a Android Module in your Android Project

You saw why using modules is important and how to create a Java module in an earlier Post. In a similar fashion you can add an Android module to your project.

Android Studio makes it easy to add a new module. Follow the video to understand the steps.

Source code is available here

What is Android Debug Bridge or ADB ?

An ADB is a command line tool which can be used to communicate with Emulator or Android Devices.

When your development machine needs to communicate with an Android Device it does so using ADB. It’s a process that is controlled by a command also known as adb.

The adb command works by talking to an adb server which runs in the background at port 5037. The server is also known as adb daemon or adbd.

Android Studio also talks to this server when it needs to run an app via an Android Device.

To work with ADB you need Android SDK.

Learn how to create and use a Java Module in Android Project

Creating modules is a good practice since it aids in reusability. In your Android project you can easily add a Java or Android module.

Follow the video to create a Java module and add it as a dependency in your Android Project.

Project source code is available in GitHub

Android Basics – Learn how the APK file Works in Android

Once you have transferred an APK file to your Android device its stored in /data/app/<package-name>

The classes.dex file is extracted from it and it’s converted to native library, when the App is run the first time, and stored in /data/dalvik-cache. This Machine Code can be run by the CPU.

Each Android device runs a process called Zygote. When an App needs to run Zygote creates a forked version of itself. Which means its a process in memory. Using this forked process and by loading the native library the App can be loaded pretty quickly.