Android Studio Ultimate Beginner’s Guide

Android Studio

Android Studio is an Open source and Linux-based Operating System for mobile devices such as smartphones and tablet computers. Android was developed by the Open Handset Alliance, led by Google. Android applications are usually developed in the Java language using the Android Software Development Kit. Once developed, android applications can be packaged easily and sold out either through the store such as Google Play, SlideME, Opera Mobile Store, Mobango, F-droid, and the Amazon Appstore.

The code names of Android ranges from A to P, such as Aestro, Blender, Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwich, Jelly Bean, KitKat, Lollipop, Marshmallow, Nougat, Oreo, Pie.

Android Studio Installation and Configuration

Follow steps is for complete installation and configuration of the android studio in Windows Operating System:-

STEP 1:- Download Android Studio: – Android studio is the official IDE for android application development. You can download Android Studio from https://developer.android.com/studio/. Following are the requirements for the Windows operating system: Microsoft Windows 7/8/10 (32/64 bits), Minimum 3GB RAM, 2GB disk space, Java JDK and JRE, Software development kit

STEP 2:- Run .exe file: -Next step is to run .exe file. Before launching Android Studio make sure, our machine should have required installed Java JDK. STEP 3:- Click on Next button and the following screen will appear. Need to check the components, which are required to create applications. Below the image has selected Android Studio, Android SDK and Android Virtual Machine.

STEP 4:- Click on Next button. Next step is to accept the License Agreement and click on I agree

STEP 5:- Next step is to specify the location ofthe local machine path for Android Studio and Android SDK. Before clicking on next make sure your disk has minimum required space. For Android Studio installation location must have at least 500MB free space. For Android SDK installation, the selected location must have at least 3.2GB free space.

STEP 6:- Next step is to choose the start menu folder, where you want to createa shortcut.

STEP 7:- Next step is to click on install and it will start installation. It would take a time to finish the task

STEP 8:- Once it’s done with the installation the following window will appear

STEP 9:- This informs you that the installation has completed. Click Finish and start the Android Studio. The following splash screen appears.

STEP 10:- Configure Android Studio: – When you open Android Studio for the first time it will ask for import settings. If you don’t have any previous settings than click on I do not have the previous version of android studio or I do not want to import my settings.

STEP 11:- Select the UI theme and click next. At the very first it will start downloading some components, wait till it gets complete

STEP 12:- After downloading gets completed click on finish and start building your android apps.

HelloWorld Example in Android Studio

Steps to create HelloWorld Example

  1. Open Android Studio If it is not Opened. Click on create a new project.
  2. In the new window, give your application an Application Name such as “HelloWorld”.Choose a unique domain. Apps published to the Google Play store must have a unique package name. Since domains are unique, your app’s name with your company’s domain name is going to result in the unique package name. If you are not planning to publish your app, you can accept the default example domain.
  3. Verify that the default Project Location is where you want to store your HelloWorld app and other Android Studio projects, or change it to your preferred directory
  4. Click next.
  5. On the Target Android Devices screen, “Phone and Tablet” should be selected.  And you should ensure that API 15: Android 4.0.3 IceCreamSandwich is set as the Minimum SDK
  6. Choosing this API level makes your application compatible with 100% of Android devices active on the Google Play Store.
  7. Click Next
  8. Every app needs at least one activity. An activity represents a single screen with a user interface and Android Studio provides templates to help you get started.
  9. For HelloWorld project choose the simplest template available i.e. Empty Activity
  10. Click next. Make sure that the Generate Layout file box and Backwards Compatibility (App Compat) box is checked. Leave the Layout Name as activity_main. Accept the defaults and click finish.
    1. Explore the project structure: – After this steps android studio creates a folder and builds the project with Gradle. The Android Studio window will have hierarchy of files for your app. In the project; there are three top-level folders below your app folder: manifests, java, res.
      1. Expand the manifests folder:- This folder contains AndroidManifest.xml file describes all the components of your android app.
      2. Expand the java folder: -All your java language files are organized in this folder.      The java folder contains three sub folders: com.example.admin.helloworld: -All the files for a package are in a folder named after the package. For HelloWorld application, there is one package and it contains MainActivity.java.  com.example.admin.helloworld(androidTest): -This folder is for your instrumented tests and starts out with a skeleton test file. com.example.admin.helloworld(test): – This folder is for your unit tests and starts out with an automatically created skeleton unit test file.
      3. Expand the res folder: – This folder contains all the resources for your app, including images, layout files, strings, icons and styling. It includes the following the following sub folders.  Drawable: – Store all your app’s images in this folder. Layout: – Every activity has at least one layout file that describes the UI in XML. For HelloWorld, this sub-folder contains activity_main.xml. Mipmap: – Store your launcher icons in this folder. There is a sub-folder for each supported screen density. Android uses the screen density, that is, the number of pixels per inch to determine the required image resolution. Android groups all actual screen densities into generalized densities, such as medium(mdpi), high(hdpi), or extra-extra-extra-high(xxxhdpi). The ic_launcher.png folder contains the default launcher icons for all the densities supported by your app. Values: -Instead of hardcoding values like strings, dimensions, and colors in your xml and Java files, it is the best practice to define them in their respective values file. This makes it easier to change and be consistent across your app.
      4. Expand the Gradle scripts folder. This folder contains all the files needed by the build system.

3. activity_main.xml

   <?xml version=”1.0″ encoding=”utf-8″?>
<android.support.constraint.ConstraintLayout

            xmlns:android=”http://schemas.android.com/apk/res/android”
xmlns:app=”http://schemas.android.com/apk/res-auto”
xmlns:tools=”http://schemas.android.com/tools”
android:layout_width=”match_parent”
android:layout_height=”match_parent”
tools:context=”.MainActivity”>

<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”Hello World!”
app:layout_constraintBottom_toBottomOf=”parent”
app:layout_constraintLeft_toLeftOf=”parent”
app:layout_constraintRight_toRightOf=”parent”
app:layout_constraintTop_toTopOf=”parent” />

</android.support.constraint.ConstraintLayout>

     4. You can now run the app on a real device or an emulator.

  1. Run on a real device: – Connect your device to your development machine with a USB cable.  Enable USB debugging in the developer options as follows. Open the settings click on About Phone and tap Build number 7 times. You are now a developer. Open the developer options and then enable USB debugging. Run the app on your device. In Android Studio, click the app module in the project window and then select Run. In the select Deployment Target window, select your device and click ok.
  2. Run on an emulator: In Android Studio, click the app module in the project window and then select Run. In the select Deployment Target window, click create a new virtual device. In the Select Hardware screen, select a phone device, such as Pixel and click next. In the System Image screen, select the version with the highest API level. Click next and  then Finish. In the select deployment target dialog, select the device you just created and click Ok.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.