0% found this document useful (0 votes)
35 views24 pages

Chapter 2 Installation & Configuration

Uploaded by

Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views24 pages

Chapter 2 Installation & Configuration

Uploaded by

Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Mobile Android Development Chp.

2 Ali Karim Sir

Chapter 2. Installation and configuration of Android


2.1 Operating System, Java JDK, Android SDK.
2.2 Android Development Tools (ADT).
2.3 Android Virtual Devices (AVDs).
2.4 Emulators.
2.5 Dalvik Virtual Machine, Difference between JVM and DVM.
2.6 Steps to install and configure Android Studio and SDK.
-----
2a. Describe function of the given component to operate the specified IDE.
2b. Explain the given term related to virtual machine.
2c. Explain the given basic term related to Android development tools.
2d. Describe the features of given android emulator.
2e. Describe the steps to configure the given android development environment.

Q. Describe Operating System.


Ans:
Operating System
To develop an Android program, the necessary supporting operating systems used in a
computer can be as follows:
a. Windows XP (32 bit), Vista (32 or 64 bit), or Windows 7 (32 or 64 bit).
b. Mac OS X (Intel) 10.5.8 (x86 only).
c. Linux (i386: tested in Lucid Lynx. Ubuntu Linux).
• GNU C Library (glibe) 17 or later is required.
• On Ubuntu Linux. version 8.04 or later is required.
• 64-bit distributions should be capable of running 32-bit applications.

Q. Describe Java JDK.


Ans:
As Android programs are developed in the Java programming language we have to install
Java Development Kit (JDK) in computer which is u free software where the JDK includes the Java SE
Runtime (JRE).

Q. Describe Android SDK


Ans:
The Android SDK (Software Development Kit) is the most important software of android
which is installed. The Android SDK provides to test android applications, the API libraries, an
emulator, Documentation, sample code, developer tools, and tutorials which help you to build, test
and debug apps for Android

Android SDK can be downloaded from http:developer.android.conm/sdk/index.htmI using


Android SDK Manager which is free. We find the Android SDK in a zip file and have to unzip its

Ali Karim Sir Classes Mumbra 9220990566 Page 1


Mobile Android Development Chp. 2 Ali Karim Sir

contents (android-sdk-windows) into a folder (c:\android\foldername). We can also create Android


virtual device (AVD) via the Android SDK, which run in the emulator.

Android SDK is made up of two main parts: the tools and the packages. When you first install
the SDK, all you obtain are the base tools. These are executable and supporting files that help you
develop applications. The packages are the records specific to a particular version of Android (called
a platform) or a particular add-on to a platform.

Some Android SDK features include:


• No licensing, distribution, or development fees.
• Wi-Fi hardware access.
• GSM, EGDE, and 3G networks for telephony or data transfer, allow you to make or receive
calls or SMS messages. otherwise to send and retrieve data across mobile networks.
• Comprehensive APIs designed for location-based services such as GPS.
• Full multimedia hardware control together with playback and recording using the camera
and microphone.
• APIs designed for accelerometer and compass hardware.
• IPC message passing.
• Shared data stores.
• An integrated open source WebKit-based browser.
• Full support for application that integrates Map controls as part of their user interface.
• Peer-to-peer (P2P) support using Google Talk.
• Mobile-optimized hardware-accelerated graphics including a path-based 2D graphics library
and support for 3D graphics using OpenGL ES.
• Media libraries designed for playing and recording a variety of audio/video or still image
Formats.

Q. Describe Android Development Tools (ADT).


Ans:
Android Development Tools (ADT) is a plugin for the Eclipse IDE which provides a suitable
environment to develop an android application where creation, compilation and debugging are
possible. ADT can able to set up new Android projects, create an application UI. insert packages
based on thu Android Framework API. debug(or clear up) your applications using the Android SDK
tools, and export signed (or unsigned) . apk files in order to distribute in the application.

Q. Describe Android Virtual Devices (AVDs).


Ans:
Android Virtual Devices (AVDs)
• An Android Virtual Device (AVD) is an emulator configuration that enables to model an
actual device by calling hardware and software options to be emulated by the Android
Emulator.

• Use the AVD Manager to create an AVD. An Android Virtual Device (AVD) is used for testing
the Android applications. An AVD is an emulator occurrence that enables to form a real
device. Each AVD consists of a hardware sketch, a connection to a system image, and
emulated storage, such as a secure digital (SD) card.
An AVD consists of:
• A hardware profile: Defines the hardware features of the virtual device. For example, you
can describe whether the device has a camera, whether it uses a physical QWERTY keyboard
or a dialing pad, how much memory it have, and so on.

Ali Karim Sir Classes Mumbra 9220990566 Page 2


Mobile Android Development Chp. 2 Ali Karim Sir

• A mapping to a system image: You can define what version of the Android platform will run
on the virtual machine. You will be able to choose a version of the standard Android
platform or the system image packaged with an SDK add-on.

• A dedicated storage area on your development machine: the device's user data (installed
applications. settings, and soon) and emulated SD card are stored in this area
• The API Level of the goal is important because our application will not be able to run on a
system image as specified in the minimum SDK Version attribute of the manifest file of that
application.

Q. Describe Emulators
Ans:
• The Android SDK comes with a virtual mobile device emulator that runs on your computer.
The emulator enables us trial product, to develop and test Android applications without
using a physical device.
• The Android emulator mimics all of the hardware and software features of typical mobile
devices, except that it cannot place actual phone calls. It provides a selection of navigation
and control keys. Which you can “press” using your mouse or keyboard to generate events
for our application. If provides a screen in which our application is displayed, together with
any other active Android applications.
• The Android emulator runs on a full Android system stack, down to the kernel level,
including a set of preinstalled applications (such as the dialer) that you can access from your
applications. We can select the version of the Android system we wish to run in the
emulator by configuring AVDs, and we can also modify the mobile device skin and key
mappings.
• While launching the emulator at the runtime, we can use a variety of commands and options
to control its behavior.
• The Android emulator offers dynamic binary translation of device machine code to the OS
and processor architecture of your development machine.
The android emulator supports many hardware features likely to be found on mobile devices,
including:
+ An ARM 5 CPU and the corresponding memory-management unit (MM1J)
+ A 16-bit LCD display
+ One or more keyboards (a Qwerty-based keyboard and associated Dpad/Phone buttons)
+ A sound chip among output and input capabilities
+ Flash memory partitions (emulated through disk image flies on the development machine)
+ A GSM modem, including a simulated SIM card
+ A camera, using a webcam connected to our development computer.

Ali Karim Sir Classes Mumbra 9220990566 Page 3


Mobile Android Development Chp. 2 Ali Karim Sir

+ Sensor like accelerometer using records from a USB-connected Android device.

Q. Describe Dalvik Virtual Machine


Ans:
➢ Google selected Java as the language for developing Android applications, thereby; it got
away with 10th JME and the JVM in favor of an alternative deployment target, the Dalvik
virtual machine. Google have also chosen to use an alternative and limited implementation
of the standard Java libraries. Both of there are unusual Java. And effectively represent fork
of the Java platform.

➢ The key figure in Google’s implementation of JVM is Dan Bronstein, who has written the
Dalvik VM-Dalvik is the name of a town in Iceland. Dalvik VM takes the generated Java class
files and combines them into one or more Dalvik Executable (.dex) files. It reuses duplicate
information from numerous class files. effectively reducing the gap requirement
(uncompressed) by half from a traditional .jar file.
➢ Android uses the Dalvik virtual machine with just-during time compilation to run Dalvik byte
code, which is frequently translated from Java bytecode. Google has also fine-tuned the
garbage collection in the Dalvik VM, but it has chosen to remove just-in-time(JIT) complier,
in early release.

➢ Android has added JIT, Dalvik VM uses a different kind of assembly-code generation, in
which it uses registers as the primary units of data storage instead of the stack. Google
expects to accomplish 30% lesser instructions as a result. The Dalvik VM relics on the Linux
kernel for underlying functionality such as threading and low-level memory management.

➢ We must remember that the final executable code in Android, as a result of the Dalvik VM, is
based not on Java byte code but on .dex files instead. This means you cannot directly
execute Java byte code: you have to start with Java class files and then convert them to
linkable .dex files.

➢ This performance is extended into the rest of the Android SDK. For example, the Android
SDK uses XML extensively to define UI layouts. However, all of this XML is compiled to binary
files before these binary file-s become resident on the devices. Android provides special
mechanisms to use this XML data.

➢ Android programs are compiled into .dex(Dalvik Executable) files, which are in turn zipped
into a single .apk file on the device. dcx file can be ereatc4 by automatically translating
complied applications written in the Java programming language.

➢ The Dalvik Debug Monitor Service (DDMS) ¡s a key debugging utility that is integrated into
the Eclipse IDE, the favored development environment for Android apps.

Ali Karim Sir Classes Mumbra 9220990566 Page 4


Mobile Android Development Chp. 2 Ali Karim Sir

Ali Karim Sir Classes Mumbra 9220990566 Page 5


Mobile Android Development Chp. 2 Ali Karim Sir

Q. Difference between JVM and DVM.

Q. Steps to install and configure Android Studio and SDK.


Ans:
Step 1 - System Requirements
You will be delighted, to know that you can start your Android application development on either
of the following operating systems −
• Microsoft® Windows® 10/8/7/Vista/2003 (32 or 64-bit)
• Mac® OS X® 10.8.5 or higher, up to 10.9 (Mavericks)
• GNOME or KDE desktop
Second point is that all the required tools to develop Android applications are open source and can
be downloaded from the Web. Following is the list of software's you will need before you start your
Android application programming.
• Java JDK5 or later version
• Java Runtime Environment (JRE) 6
• Android Studio
Step 2 - Setup Android Studio
Overview
Android Studio is the official IDE for android application development.It works based on IntelliJ
IDEA, You can download the latest version of android studio from Android Studio 2.2 Download, If
you are new to installing Android Studio on windows,you will find a file, which is named as android-
studio-bundle-143.3101438-windows.exe.So just download and run on windows machine according
to android studio wizard guideline.
If you are installing Android Studio on Mac or Linux, You can download the latest version
from Android Studio Mac Download,or Android Studio Linux Download, check the instructions
provided along with the downloaded file for Mac OS and Linux. This tutorial will consider that you
are going to setup your environment on Windows machine having Windows 8.1 operating system.
Installation
So let's launch Android Studio.exe, Make sure before launch Android Studio, Our Machine should
require installed Java JDK. To install Java JDK,take a references of Android environment setup

Ali Karim Sir Classes Mumbra 9220990566 Page 6


Mobile Android Development Chp. 2 Ali Karim Sir

Once you launched Android Studio, its time to mention JDK7 path or later version in android studio
installer.

Below the image initiating JDK to android SDK

Ali Karim Sir Classes Mumbra 9220990566 Page 7


Mobile Android Development Chp. 2 Ali Karim Sir

Need to check the components, which are required to create applications, below the image has
selected Android Studio, Android SDK, Android Virtual Machine and performance(Intel chip).

Need to specify the location of local machine path for Android studio and Android SDK, below the
image has taken default location of windows 8.1 x64 bit architecture.

Need to specify the ram space for Android emulator by default it would take 512MB of local
machine RAM.

Ali Karim Sir Classes Mumbra 9220990566 Page 8


Mobile Android Development Chp. 2 Ali Karim Sir

At final stage, it would extract SDK packages into our local machine, it would take a while time to
finish the task and would take 2626MB of Hard disk space.

After done all above steps perfectly, you must get finish button and it gonna be open android
studio project with Welcome to android studio message as shown below

You can start your application development by calling start a new android studio project. in a new
installation frame should ask Application name, package information and location of the project.

Ali Karim Sir Classes Mumbra 9220990566 Page 9


Mobile Android Development Chp. 2 Ali Karim Sir

After entered application name, it going to be called select the form factors your application runs
on, here need to specify Minimum SDK, in our tutorial, I have declared as API23: Android
6.0(Mashmallow)

Ali Karim Sir Classes Mumbra 9220990566 Page 10


Mobile Android Development Chp. 2 Ali Karim Sir

The next level of installation should contain selecting the activity to mobile, it specifies the default
layout for Applications

Ali Karim Sir Classes Mumbra 9220990566 Page 11


Mobile Android Development Chp. 2 Ali Karim Sir

Ali Karim Sir Classes Mumbra 9220990566 Page 12


Mobile Android Development Chp. 2 Ali Karim Sir

At the final stage it going to be open development tool to write the application code.

Ali Karim Sir Classes Mumbra 9220990566 Page 13


Mobile Android Development Chp. 2 Ali Karim Sir

Step 3 - Create Android Virtual Device


To test your Android applications, you will need a virtual Android device. So before we start writing
our code, let us create an Android virtual device. Launch Android AVD Manager Clicking
AVD_Manager icon as shown below

Ali Karim Sir Classes Mumbra 9220990566 Page 14


Mobile Android Development Chp. 2 Ali Karim Sir

Ali Karim Sir Classes Mumbra 9220990566 Page 15


Mobile Android Development Chp. 2 Ali Karim Sir

Ali Karim Sir Classes Mumbra 9220990566 Page 16


Mobile Android Development Chp. 2 Ali Karim Sir

Ali Karim Sir Classes Mumbra 9220990566 Page 17


Mobile Android Development Chp. 2 Ali Karim Sir

After Click on a virtual device icon, it going to be shown by default virtual devices which are present
on your SDK, or else need to create a virtual device by clicking Create new Virtual device button

Ali Karim Sir Classes Mumbra 9220990566 Page 18


Mobile Android Development Chp. 2 Ali Karim Sir

Ali Karim Sir Classes Mumbra 9220990566 Page 19


Mobile Android Development Chp. 2 Ali Karim Sir

Ali Karim Sir Classes Mumbra 9220990566 Page 20


Mobile Android Development Chp. 2 Ali Karim Sir

Ali Karim Sir Classes Mumbra 9220990566 Page 21


Mobile Android Development Chp. 2 Ali Karim Sir

Ali Karim Sir Classes Mumbra 9220990566 Page 22


Mobile Android Development Chp. 2 Ali Karim Sir

If your AVD is created successfully it means your environment is ready for Android application
development. If you like, you can close this window using top-right cross button. Better you re-start
your machine and once you are done with this last step, you are ready to proceed for your first
Android example but before that we will see few more important concepts related to Android
Application Development.
Hello Word Example
Before Writing a Hello word code, you must know about XML tags.To write hello word code, you
should redirect to App>res>layout>Activity_main.xml

Ali Karim Sir Classes Mumbra 9220990566 Page 23


Mobile Android Development Chp. 2 Ali Karim Sir

To show hello word, we need to call text view with layout ( about text view and layout, you must
take references at Relative Layout and Text View ).
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

<TextView android:text="@string/hello_world"
android:layout_width="550dp"
android:layout_height="wrap_content" />
</RelativeLayout>
Need to run the program by clicking Run>Run App or else need to call shift+f10key. Finally, result
should be placed at Virtual devices as shown below

Ali Karim Sir Classes Mumbra 9220990566 Page 24

You might also like