Beginners guide to Android App Development in 2024-Create your First app in Android | Android Studio | Kotlin

Android development can be a great way to turn your idea into reality or start a career in android development. It is a lot easier than you think just be with this me and you will get it all.

Basically development is done in two ways for apps:-

1. Native Development : In this we use platform specific tools to make apps in that like for android we use either Kotlin or Java and for iOS we use swift language for development’s written for one platform will run only in that system only.

2. Cross Platform Development : In this type we write code once which is independent of platforms means which will run on both Android and iOS . For this we use famous frameworks like React native , flutter.

Now if you decided to which one to start with, So lets learn how to get into it.

I will choose native development and in this article will show you how to make your first android App with no prior knowledge in android or any programming language.

What is Android?

Android is an open source Linux kernel based operating system for mobile phones maintained by Google and even by me🤭(By developing nice apps). Now understand it one by one-

1. Open source : This mean the code of android OS is open to everyone and we can introduce something new in it with permission of Google.

2. Linux Kernel : Kernel is like an manager in an computer. It is a bridge b/w hardware & software layers which manages all the system processes. This Kernel is specific to an OS like for windows OS we call it WindowNT but for Linux OS we call it Linux kernel . So in a nutshell Linux kernel is an Linux OS based Manager of all the processes which are running in the system at any time.

3. Operating System: Really guys’ you don’t know about OS. Ok then look- this is the Mastermind of everything in a PC . It controls all the process in computer with the help of kernel .Think like it is the King(OS) in the Kingdom(Computer) who controls everything with its cabinets Ministers(Kernel) and ensures that everything goes smooth.

Why to learn android in 2024?

  1. Android has over 3 billion active users.
  2. Three quarters of all smartphones in the world run Android.
  3. Over 1.5 billion Android smartphones were shipped last year.

Why it is hard to start with Android Development?

1. Learning Curve is very steep because it is hard to learn android architecture for newbie at first and Android Studio(IDE for android apps) itself seems very complicated at first .
2. 

Device compatibility : Because of regular updates in Android Versions it is require you to keep your apps compatible to all devices.3. 

High end System: You need a high end PC or laptop to get started with android development. Android Studio require minimum 8 GB of RAM and i3 processor. which everyone can’t get just to start with a app idea kicking in their mind.

Now you know at least basics about android . So its time to start collecting required tools for android development. For this we need IDE’s which means Integrated Development Environments and for android development we will use Android Studio (Xcode is used for iOS apps) but before that lets talk about it.

Android studio : It is a combination of development tools into one software/package which will help in app development. You can under stand it like it is the WordPad for Apps Which has features likes :

1. It has its own code editor which will beatify code and help in code readability .

2. It has built in Complier/Interpreter which will convert your code into machine readable format .

3. Debugger will help to test your app and gives warnings when you break the rules of android.

4. It includes Version Control System in it which will maintain your code history.

5.  It manages your project Settings ,Organizing files in your project and many more.

6. At last but not the least after you press RUN button it will Compile, build and wrap up your app in a package called .apk file which will be ready to run on any android device or Emulator(Virtual Android Device on Android Studio).

Android Studio Download link-Download Android Studio & App Tools – Android Developers

Before that you also need to know one thing which will help you to install it -Android SDK

Software Development Kit- Simply understand this as a kit of tools & resources to create applications for android platform which is developed by Google. It includes all the required libraries , API(we talk about it later) , sample codes, documentation and this SDK will work together with IDE’s to make our apps. When you install android studio it will automatically detects that you have installed SDK or if not then it will ask you to download it and you are good to go.

I hope you have installed it in your pc till now lets now use it and make our app idea into reality.

When you first time open it you will see a screen like this click to create new project

In this screen you will enter details of your project like this-

Android think that your app name will become some billion dollar company some day so he thinks that you will buy a domain which will be yourapp.com and android studio changes it with com.yourapp so this it can identify your app uniquely on play store its is important guys keep it unique otherwise when you go to launch it on Play Store google will say ‘already exist’, So keep that in mind.

Always keep in mind that it will never changes, it uniquely identify your app on internet. when you update your app with newer versions then only the version number will change this package name will be same forever.

Selection of API level is a Tricky task of beginners . So let me make it simple to grasp for you and leave it up to you to decide which API level is best suited for your app.

But before that lets first understand What is an API ?

Application Programming Interface– in general are set of rules that allows different software or a software with a service to communicate with each other for sharing information. Lets take an example of a web address when you type any web address in google means that web address of any site is like an API for  you and the servers of that API will help google to collect data from them and serve that to you.

Similarly in android API are written instructions in Android SDK which will bring one kind of information from OS . So each API has its own purpose and these are of many types have a look on these-

1. Android Framework API: These are simple Classes or functions/methods written in SDK which will work like a bridge b/w your app and OS like Camera Manger API , Sensor Manger, etc.

2. Google play Services API: These API will help google to monitor and controls inbuilt apps which will help you to be safe and provide some basic functionality.

3. Third Party APIs: These are external APIs you will use in your app to integrate some functionality which is very much hard to do it yourself like Payment gateways etc.

That is all about APIs now come to our app. So you know about APIs and also know why we or android use these . So lets think that you made an API which will detect an sound of dog and warn you about the danger ahead . So this works fine so far but you know dog 🐶 is not an only animal which can harm you so your want to update your API now so that it can detect other dangerous animal too . So this time you update the code of this API and give this a Version 2.0 which will help you and others to identify some other dangerous animal around you. But this will save you from all animals if you have the newer version of this API because the older API only identify dogs .

 The API level is just a number which identifies the android framework API’s newer versions at the time when new android platform version comes.

Similarly android also updates its system APIs with new features with time so that you are safe and up to date with fast growing world.

Now  its time to decide which API level will you select for you app . Each Android Version will have a certain API level like

This means if your android has version 11 then it will only support API levels 30s. So if you set your app’s min target API to 11 means your app will only runs on device which have android 11 or higher so target this at least 11 is good if you think that I will set it to version 5 so that my app run run of all devices then you can’t use feature’s in your app which were added in the later versions of android. So choice is yours . Now come to the build configuration language.

Before that lets talk about Gradle which you will see a lot in your project so what is it?

Gradle is a packaging department in IDE’s means when you just tired writing 10000 lines of code and hit that run app button then someone should be there to wrap all you curry and make something useful out of it, so that nice person is Gradle which is a build automation system which will convert all your project files into something that can run on any android device . It done a lot of useful stuff like compiling resource of app, manages dependency on external libraires in app, creating different version of your apps, instant run of app to check if everything is fine or not & last but not the least code shrinking (to reduce size of your app ). So far so good na…

Now come to this selection which one to choose this is saying that instructions of Gradle were previously written  in Groove but from Giraffe (android studio versions) these instructions were written in Kotlin language itself. This domain-specific language (DSL) is a type of programming language that is tailored to a build automation domain for describing build scripts.

So you can select any this as you want but as it says Kotlin DSL is recommended so go with it

The next thing you’ll be prompted to do is to add an activity to your project .Every app is a collection of screens and each screen is compromised of an activity and a layout.

Activity is sum of the design you see on your app screen and the logic connected to this design which will come into place when you just open an app or go from one screen to other like when you open the profile screen of your favorites social media app like fb then it will show you all your details and if your want to interact with this screen e.g. logout from app then the logic will handle the clicks and do the job and send you again on login page.

Just see what happens when you open the app:

1. Device launches your app and create the first activity or screen

2.  Then this activity specifiy or connect itself with the layout(the screen your see)

3.  Then this activity tells android to display the layout on screen

4.  Now you can interact with the layout that is displayed to you

5. The activity respond to these interactions by running the logic(Java or Kotlin code)

6. The activity now updates the screen with new information and so on…

When you press the finish button then that Nice guy “Gradle” will start to build the basic structure of your app and it takes some time depends on your system.

Now we come to  main page of this IDE Android studio(the best thing I have ever used)

You will will feel threatening at first looking this interface but don’t worry its not that much tough to learn, be with me

There are two tabs open in here:

1. MainActivity.kt -This will contain all your logic for this screen

2. actvity_main.xml -This will contain the design of the screen

Before that have some talk on XML ,What is that?

eXtensible Markup Language – It define layouts, configuration ,arrangement & appearance of UI elements of a document.XML was designed to store and transport data. It is both human and machine language.

Markup language is a system to create nice looking documents on internet, it is like makeup artist of words. When you place words in predefined fashion then they will look beautiful and this predefine fashion is written in Markup language that will enhance the look of words and sentences .

Or to tell you this in programming language – Markup language is text encoding system which will specifies the structure and formation of a documents used to format data in a specific way.

First we will talk about the xml layout and go to the design editor .

This is the way you will design your whole app, seems prity overwhelming no

But don’t worry we have two options to adds views First by writing code with help of auto completion and other and the simple way to just drag and drop any view as you want

This is the basic structure of any xml file

<?xml version="1.0" encoding="UTF-8"?> 
<!--XMl version Deceleration-->
<parentLayout <!--Root element-->
    android:layout_width="match_parent"
    <!--an attribute which should have a 
unique name within the same tag-->
    android:layout_height="match_parent">

      <!--child node-->
      <childLayout
         android:id="@+id/textView"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="This is my app"
         android:textColor="#D33030"
         android:textSize="25dp"
         />

</parentLayout> 
<!--all element should have a corresponding closing tag-->

So in this way you can add any amount of views in this layout and arrange them with the help of  parent layout

So we have added a text and a button to keep this app simple as possible

I have write comment to help you under stand the use of some attribute and elements.

Now come to code editor and write some logic that will help us to interact with the app

Now if run the app this will run fine but the button will not response anything because we have not give instruction to the activity to when to do what e.g. what to show on the text or what to do when someone press the button, so lets do that

This the basic layout and structure of an Activity file , this file is written in either java or Kotlin language which you have decided earlier.

This the what and why of this screen just have a look don’t take is serious

/*code start*/
package com.myfirstapp
//this is package name of our app

//these are saying that in this screen you have use some
//methods from these parents classes
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import android.widget.Toast

//this is our main class 
class MainActivity : AppCompatActivity() {
    
    //this the first function which will run first when app starts
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //this line saying that connect the design part with the logic activity
        setContentView(R.layout.activity_main)
        
        //here we telling android that give us the contact of our views so that 
        //we can interact with them

        val textView=findViewById<TextView>(R.id.textView)
        val button=findViewById<Button>(R.id.button)
        
        //now we are saying that when someone will click on button then...
        button.setOnClickListener {
            
            //show a toast message on screen
            Toast.makeText(this, "Hello World!", Toast.LENGTH_SHORT).show()
            
            //also set this value on the text on screen
            textView.text="I have created my first app"
        }
    }
}
/*code end*/

When you hit the run button then studio will say ‘No target device found to run app’ which means you

you didn’t connect an device to run this app. You can run your apps in two ways 

1. On Real Android Phone 

2. On Android Emulator(which is like an android simulator)

Download the device in Studio and run the app. 

That is all for this article .

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top