You are on page 1of 9

Android Notes

Chapter 2nd – Installation & Configuration

What is Android Emulator ?


The Android emulator is an Android Virtual Device (AVD), which
represents a specific Android device. We can use the Android emulator as a
target device to execute and test our Android application on our PC. The
Android emulator provides almost all the functionality of a real device. We can
get the incoming phone calls and text messages. It also gives the location of the
device and simulates different network speeds. Android emulator simulates
rotation and other hardware sensors. It accesses the Google Play store, and
much more.

Install the emulator

The Android emulator is installed while installing the Android Studio. However
some components of emulator may or may not be installed while installing
Android Studio. To install the emulator component, select the Android
Emulator component in the SDK Tools tab of the SDK Manager.

Run an Android app on the Emulator

We can run an Android app form the Android Studio project, or we can run an
app which is installed on the Android Emulator as we run any app on a device.

To start the Android Emulator and run an application in our project:


1. In Android Studio, we need to create an Android Virtual Device (AVD) that
the emulator can use to install and run your app. To create a new AVD:-

1.1 Open the AVD Manager by clicking Tools > AVD Manager.

1.2 Click on Create Virtual Device, at the bottom of the AVD Manager dialog.
Then Select Hardware page appears.
1.3 Select a hardware profile and then click Next. If we don?t see the hardware
profile we want, then we can create or import a hardware profile. The System
Image page appears.

1.4 Select the system image for the particular API level and click Next. This
leads to open a Verify Configuration page.
1.5 Change AVD properties if needed, and then click Finish.

2. In the toolbar, choose the AVD, which we want to run our app from the target
device from the drop-down menu.

3. Click Run.

Launch the Emulator without first running an app


To start the emulator:

1. Open the AVD Manager.


2. Double-click an AVD, or click Run

What is Dalvik Virtual Machine ?


Dalvik Virtual Machine is a Register-Based virtual machine. It was designed
and written by Dan Bornstein with contributions of other Google engineers as
part of the Android mobile phone platform. The Dalvik virtual machine was
named after Bornstein after the fishing village “Dalvík” in Eyjafjörður,
Iceland, where some of his ancestors used to live.
Application

For Android, a new Virtual machine was developed by Google as stated


above. It uses registers of the CPU to store the operands. So no requirement of
any pushing and popping of instructions. Hence making execution faster. The
instructions operate on virtual registers, being those virtual registers memory
positions in the host device. Register-based models are good at optimizing and
running on low memory. They can store common sub-expression results which
can be used again in the future. This is not possible in a Stack-based model at
all. Dalvik Virtual Machine uses its own byte-code and runs “.dex”(Dalvik
Executable File) file.

Advantages

 DVM supports the Android operating system only.


 In DVM executable is APK.
 Execution is faster.
 From Android 2.2 SDK Dalvik has it’s own JIT (Just In Time) compiler.
 DVM has been designed so that a device can run multiple instances of the
Virtual Machine effectively.
 Applications are given their own instances.

Disadvantages

 DVM supports only Android Operating System.


 For DVM very few Re-Tools are available.
 Requires more instructions than register machines to implement the same
high-level code.
 App Installation takes more time due to dex.
 More internal storage is required.

JDK

The Java Development Kit (JDK) is a cross-platformed software development


environment that offers a collection of tools and libraries necessary for
developing Java-based software applications and applets. It is a core package
used in Java, along with the JVM (Java Virtual Machine) and the JRE (Java
Runtime Environment).

Beginners often get confused with JRE and JDK, if you are only interested in
running Java programs on your machine then you can easily do it using Java
Runtime Environment. However, if you would like to develop a Java-based
software application then along with JRE you may need some additional
necessary tools, which is called JDK.

JDK=JRE+Development Tools

SDK

Android SDK is a collection of libraries and Software Development tools that


are essential for Developing Android Applications. Whenever Google releases
a new version or update of Android Software, a corresponding SDK also
releases with it. In the updated or new version of SDK, some more features are
included which are not present in the previous version. Android SDK consists
of some tools which are very essential for the development of Android
Application.

These tools provide a smooth flow of the development process from


developing and debugging. Android SDK is compatible with all operating
systems such as Windows, Linux, macOS, etc.

Components of Android SDK

Android SDK Components play a major role in the Development of Android


applications. Below are the important components:

1. Android SDK Tools

Android SDK tool is an important component of Android SDK. It consists of a


complete set of development and debugging tools. Below are the SDK
developer tools:

 Android SDK Build tool.


 Android Emulator.
 Android SDK Platform-tools.
 Android SDK Tools.

2. Android SDK Build-Tools


Android SDK build tools are used for building actual binaries of Android App.
The main functions of Android SDK Build tools are built, debug, run and test
Android applications. The latest version of the Android SDK Build tool is
30.0.3. While downloading or updating Android in our System, one must
ensure that its latest version is download in SDK Components.

3. Android Emulator

An Android Emulator is a device that simulates an Android device on your


system. Suppose we want to run our android application that we code. One
option is that we will run this on our Android Mobile by Enabling USB
Debugging on our mobile.

You might also like