A Super Easy Guide to Build Your First Android App in Java Using Android Studio

A Super Easy Guide to Build Your First Android App in Java Using Android Studio
Build Your First Android App

Creating Your First Android Studio Project is Vital 

It always creates goosebumps in the dreamers when they are going to take the first step towards their dream. Same is the case for the those who want to learn android development and looking for the right guide and path. Its really vital for the learners who are spending their time energy for learning android development. So if your are reading this blog, I assure you that you are on the right track. Believe me or not, Creating your first project and building your first android app is going to be a super easy task for you and this tutorial will also cover some other basic concepts too. So, be ready and lets get started.

Important Note

Before starting the android studio guide, I want to recommend you to have a good and stable internet connection to avoid any kind of inconvenience, disturbance, uneasiness and cumbersomeness. 

Step 1

First of all, open your android studio. You will see the following screen will different options. You can see a highlighted option in red colored rectangle saying "Start a new android studio project". Click on this option and a new window will pop-up.
A Super Easy Guide to Build Your First Android App in Java Using Android Studio
Build Your First Android App

Select a Project Template

This new window will offer you some readymade app templates. You can select any of them but as you are learning to build your  first android studio app in java, I suggest you to select the empty activity and click on the next button. This empty activity can be converted to any other template if you have good coding skills and those we will learn in our upcoming tutorials.
Build Your First Android App
Build Your First Android App

Configure Your Project

After clicking on the next button, I new window will pop-up and this window is very important. You need to learn the options given in this window very carefully. The first option is related to name of your app you want to create. As we are building our first android studio app in java using android studio so I named it as "My First Android App".
The second option is "Package Name". This package name is used by android devices to differentiate between different android apps so this package name should be unique and different for your different apps.
Then the third option will specify the location of your project and you can leave this as it is.
The language of your project should be selected "Java" as we are creating our android studio project in java. The minimum SDK should be selected such as your app can cover maximum number of devices. That's it. Now just click on the finish button and your project is created and ready to build.
Build Your First Android App
Build Your First Android App

Step 2

Important Note

When you have created your first project successfully, the next step is to build your android studio project. But before heading towards building your project, I want to discuss some of the things with you which are very important to understand and learn for android development. 

MainActivity.java file

This is the window which will appear after clicking the finish button. This window contains two types of files. The first one is XML file and the second is Java file. This Java file is used to code for your app. This is the main activity file and very important for your project.

Build Your First Android App
Build Your First Android App

activity_main.xml

This is the main xml file and you can say that the main user interface of your app. This file is used to create the front view of your app. On the lest side, you can see a palette section which have different ingredients available for your app. You can drag and drop all these ingredients in your app and make use of them. 
On the right side, you can see three different options code, split, and design. Currently, the design option is selected and you can see this window which have only UI section. If you click on code, the code section will appear only. But if you click on the "Split" button, it will show you the code and the UI at the same time.
Activity_main.xml
Activity_main.xml

This is the window you will see after clicking the "Split" button. On the left side, you can edit your xml code and on the right side, you can monitor the effects of that code on the UI of your app.
Activity_main.xml
Activity_main.xml

Android Manifest File

This file is as important for android apps as brain for human body. This file contains all the information regarding your app. This is the file which is read by android OS when your app is installed on android device. This file tells the OS that what is the name of application, the package name, the name and number of activities, the parent activities and their child activities, the permissions required for the app, the services and many more information. So if you want to ask some special permissions you need to add those permissions in this file and how to add them here, we will learn this in upcoming tutorials.

Android Manifest
Android Manifest

build.gradle (Module: app) File

This is another important file and you need to learn this file also. First of all you need to locate this file. After your project build successfully, you will see a project option selected on the left side and there will be an elephant sign. You need to maximize it as I have done and the following options will appear. The first two files are build.gradle files but you need to select the second file which are displaying Module:app text in the bracket. Double click on this file and it will open in the editor section.
Build.gradle File
Build.gradle File
As I mentioned earlier this file is also very important as it contains the information of compile SDK version, Build tools version, the application ID, minimum sdk version, the target sdk version, version code, version name and the dependencies used in your app all are listed here. This file must be synced successfully and properly.
Build.gradle File
Build.gradle File

Build Your First Android Studio Project

We have go through all basic and important steps and now we will build our first android app in android studio. At the top of your android studio, you can see the following options. 
Build Your First Android Studio Project
Build Your First Android Studio Project

At number 8 you can see an option "Build" this is used to build the apps and for some other purposes too. We will discuss them later now we will just discuss the build option only. As you click on this button, it will dropdown and the following options will appear.
Build Your First Android Studio Project
Build Your First Android Studio Project

There is an option "Build Bundle(s) / APK (s) click on that option and it will further dropdown,
Build Your First Android Studio Project
Build Your First Android Studio Project

Here you need to select the "Build APK(s) option.

Note

You can also select the "Generate Signed Bundle / APK" option but that is used when we need to publish our apps on app store and we will learn that option later on.

After selecting the "Build APK(s) option the gradle build will start running at the bottom of your android studio and it will take some time to build your app. Have patience.
Build Your First Android Studio Project
Build Your First Android Studio Project
After some time, your app will be build and this option will be shown to you.
Build Your First Android Studio Project
Build Your First Android Studio Project
Just click on the "locate" option and it will option the location of your apk file. 
Build Your First Android Studio Project
Build Your First Android Studio Project
Use this file to install your app in your android mobile phone and test this app.

Suggestions / Queries 

I hope this tutorial is useful for my visitors and is able to help and guide them properly. If you have any query you can comment your queries below or you can contact us using our contact us page.




Post a Comment

0 Comments