0% found this document useful (0 votes)
0 views

Ch2 Installation and Configuration of Android

This document provides an overview of the installation and configuration of Android development tools, focusing on Android Studio, the Android SDK, and various emulators. It outlines the necessary operating systems, the Java Development Kit, and the features of Android Virtual Devices (AVDs) for testing applications. Additionally, it discusses the Dalvik Virtual Machine and its role in executing Android applications, emphasizing the importance of understanding these components for effective Android development.

Uploaded by

khn.salman901
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Ch2 Installation and Configuration of Android

This document provides an overview of the installation and configuration of Android development tools, focusing on Android Studio, the Android SDK, and various emulators. It outlines the necessary operating systems, the Java Development Kit, and the features of Android Virtual Devices (AVDs) for testing applications. Additionally, it discusses the Dalvik Virtual Machine and its role in executing Android applications, emphasizing the importance of understanding these components for effective Android development.

Uploaded by

khn.salman901
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

2…

Installation and
Configuration of Android
Chapter Outcomes...
▣ Describe function of the given component to operate the specified IDE.
▣ Explain the given term related to virtual machine.
▣ Explain the given basic term related to Android development tools.
▣ Describe the features of given Android emulator.
▣ Describe the steps to configure the given android development environment.

Learning Objectives…
▣ To learn Android Installation
▣ To study Configuration of Android

2.0 INTRODUCTION
• Android Studio is Google's officially supported IDE for developing Android apps. Android is
an Operating System for mobile devices developed by Google, which is built upon Linux kernel.
• In this chapter, a new android learner/beginner will have a brief understanding of Android SDK and
Android ADT. We will also learn about the concepts like Android AVD, Dalvik Virtual Machine and to
know how to do installation of eclipse and SDK.

2.1 OPERATING SYSTEM


• To develop an Android program, the necessary supporting operating systems used in a computer can
be as follows:
1. Windows XP (32-bit), Vista (32-bit or 64-bit) or Windows 7 (32-bit or 64-bit) Windows 8/10 (32-bit
or 64-bit)
2. Mac OS X (10.5.8 or later (Intel chips only))
3. Linux (Ubuntu Linux version 8.04 or later and GNU C Library 2.7 or later)
2.1.1 Java JDK
• An Android operating system program is developed in the Java programming language we have to
install Java Development Kit (JDK) in computer which is free software where the JDK includes the
Java SE Runtime (JRE).
• Android Studio uses the Java tool chain to build, so we need to make sure that we have the Java
Development Kit (JDK) installed on the computer before we start using Android Studio.
2.1.2 Android SDK

[2.1]
Mobile Application Development 2.2 Installation and Configuration of Android

• The Android Software Development Kit (SDK) allows developers to create applications for the
Android platform.
• 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 us to build, test and debug
apps from Android.

Android SDK

Debugge Libraries Emulato Documen Sample Tutorials


r r tation Code

Fig. 2.1
• The android Software Development Kit (SDK) provides the tools and application programming
interfaces (APIs) for developers to create applications on the Android platform using the Java
programming language.
• Android SDK can be downloaded from https://developer.android.com/studio using Android SDK
Manager which is free.
• We find the Android SDK in a zip file and have to unzip its contents into a folder. We can also create
Android Virtual Devices (AVD) via the Android SDK, which run in the emulator.
• Android SDK is made up of two main parts namely, the tools and the packages. When we first install
the SDK, all us obtain are the basic tools. These are executables and supporting files that will help us
to develop applications.
• Some Android SDK, features include:
1. No licensing, distribution, or development fees.
2. Wi-Fi hardware access.
3. IPC message passing.
4. Shared data stores.
5. An integrated open source WebKit-based browser.
6. Full support for application that integrate Map controls as part of their interface.
7. Peer-to-peer (P2P) support using Google Talk.
Platform Used:
• To develop Android application we use the Android Studio, Android Debug Bridge, AVD Manager,
Eclipse, IntelliJ and AIDE different Integrated Development Environment (IDEs) which supports
multiple languages such as Java, C, C++, COBOL, Python, etc. It is such type of environment upon
which the extensible plug-in can run.
2.2 ANDROID DEVELOPMENT TOOLS
Mobile Application Development 2.3 Installation and Configuration of Android

• Android it is necessary to connect with the Android SDK. Linking is represented by the plug in
named Android Development Tool (ADT), which extends the capabilities of Eclips and allows the
rapid development of Android projects.
• ADT in Android 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 in Android can able to set up new Android projects, create an application UI, inset packages
based on the Android Framework API, debug (or clear up) our applications using the Android SDK
tools, and export signed (or unsigned) .apk files in order to distribute in the application.
• Also ADT in Android provides custom XML.editors and debug output pane from which we get the
unbelievable enhance during develop the Android applications Android Developer Tools Bundle (ADT
Bundle) provides Eclipse + ADT plugin, Android SDK Tools, Android Platform-tools, The most recent
Android platform, The newest Android system image for the emulator and so on.

Fig. 2.2: Android ADT


1. Android Studio:
• As the official integrated development environment for all Android applications, Android
Studio always seems to top the list of preferred tools for developers.
Mobile Application Development 2.4 Installation and Configuration of Android

Fig. 2.3
• Google created Android Studio back in 2013. It replaced – or should we say it eclipsed? Eclipse
Android Development Tools (ADT) as the primary IDE for native Android app development.
• Android Studio provides code editing, debugging, and testing tools all within an easy-to-use drag-
and-drop interface. It is free to download and is supported not only by Google, but also by a large and
actively engaged community of Android developers.
2. ADB (android Debug Bridge):
• Android Studio includes the Android Debug Bridge, which is a command-line tool or “bridge” of
communication between Android devices and other computers that can be used during development
and the overall debugging and QA process.
• By connecting an Android device to the development PC and entering a series of terminal
commands, a developer is able to make modifications as needed to both devices.
3. AVD Manager:
• Another useful feature of Android Studio is the AVD Manager, the short form for Android Virtual
Device.
• The AVD Manager is an emulator used to run Android apps on a computer. This allows developers the
ability to work with all types of Android devices to test responsiveness and performance on different
versions, screen sizes, and resolutions.
4. Eclipse:
• As we mentioned above, there was Eclipse before there was Android Studio. For a long time, Eclipse
was the officially preferred IDE for all Android application development.
• Even though Google no longer offers support for Eclipse, many developers still use it to create
Android and other cross-platform apps, as it works very well with many different programming
languages.
5. Fabric:
• Fabric is the development platform behind Twitter’s mobile application. It gives developers the
ability to build better mobile apps by providing them with a suite of “kits” that they can pick and
choose from. These kits include everything from beta-testing to marketing and advertising tools.
Mobile Application Development 2.5 Installation and Configuration of Android

• Google purchased Fabric from Twitter in January of 2017. Uber, Spotify, Square, Groupon, Yelp, and
more big-name companies have utilized Fabric in developing their mobile applications.
6. Flow Up:
• FlowUp allows you to monitor the performance of all our production apps. Handy dashboards let you
keep track of us stats and metrics, including CPU and disk usage, memory usage, frames per second,
bandwidth, and more.
• FlowUp is a monthly subscription-based SaaS solution with pricing determined by the total number
of users in the company.
7. GameMaker :Stdio
• For Android game developers, one of the most popular development tools is GameMaker: Studio.
GameMaker provides everything you need to create 2D games using very little code. It is an
extremely user-friendly application with a simple drag-and-drop interface.
• GameMaker: Studio is targeted to beginner and novice gaming developers.
8. Genymotion:
• Another Android emulator, Genymotion helps developers test and preview an application on over
3,000 device scenarios. Genymotion is popular among gaming developers because it comes with pre-
installed standard Android images and graphics that are quite useful in the testing process. It also
provides greater speed than testing an app on an actual Android device.
• Genymotion is a cross-platform development tool and supports many different programming
languages and environments.
9. Gradle:
• Back in 2013, Google endorsed Gradle as a build system for Android apps. Based on Apache Maven
and Apache Ant, Gradle is one of the most popular development tools for creating large-scale
applications involving Java.
• Developers like using Gradle in conjunction with Android Studio because it’s very easy to add
external libraries using a single line of code.
10. IntelliJ IDEA:
• From the developers at JetBrains, IntelliJ IDEA is designed for ultimate programmer productivity. It’s
extremely fast and features a full suite of development tools right out of the box.
• At $149 per year, IntelliJ IDEA certainly isn’t cheap. However, there is a free, open source community
edition available and the full extended version is free to students for one year.
2.3 ANDROID VIRTUAL DEVICES (AVDS)
• An Android Virtual Device (AVD) represents a device configuration. An AVD is a configuration that
defines the characteristics of an Android phone, tablet, Wear OS, Android TV, or Automotive OS
device that you want to simulate in the Android Emulator.
• An 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.
• The AVD Manager is an interface we can launch from Android Studio that helps you create and
manage AVDs.
• An AVD is used for testing the Android applications. To open the AVD Manager, do one of the
following:
Select Tools > AVD Manager.

Click AVD Manager in the toolbar.


Mobile Application Development 2.6 Installation and Configuration of Android

Fig. 2.4: Android AVD


Things About AVDs:
• An AVD contains a hardware profile, system image, storage area, skin, and other properties.
• We recommend that you create an AVD for each system image that your app could potentially
support based on the <uses-sdk> setting in our manifest.
1. Hardware Profile:
• The hardware profile defines the characteristics of a device as shipped from the factory. The AVD
Manager comes preloaded with certain hardware profiles, such as Pixel devices, and you can define
or customize the hardware profiles as needed.
• Notice that only some hardware profiles are indicated to include Play Store. This indicates that these
profiles are fully CTS compliant and may use system images that include the Play Store app.
2. System Images:
• A system image labeled with Google APIs includes access to Google Play services.
• A system image labeled with the Google Play logo in the Play Store column includes the Google Play
Store app and access to Google Play services, including a Google Play tab in the Extended controls
dialog that provides a convenient button for updating Google Play services on the device.
• To ensure app security and a consistent experience with physical devices, system images with the
Google Play Store included are signed with a release key, which means that you cannot get elevated
privileges (root) with these images.
• If we require elevated privileges (root) to aid with your app troubleshooting, we can use the Android
Open Source Project (AOSP) system images that do not include Google apps or services.
3. Storage Area:
• The AVD has a dedicated storage area on your development machine. It stores the device user data,
such as installed apps and settings, as well as an emulated SD card. If needed, we can use the AVD
Manager to wipe user data, so the device has the same data as if it were new.
4. Skin
• An emulator skin specifies the appearance of a device. The AVD Manager provides some predefined
skins. We can also define your own, or use skins provided by third parties.
6. AVD and app Features:
• Be sure our AVD definition includes the device features our app depends on.
2.4 EMULATORS
• Android emulator is responsible for running, debugging and testing the Android application.
Mobile Application Development 2.7 Installation and Configuration of Android

• The Android SDK comes with a virtual mobile device emulator that rums on the computer. The
emulators enables us trail product to develop android application without using a physical device.
• The android emulator mimics all the hardware and software features of typical mobile devices,
except that it cannot place annual phone calls.
• It provides a selection of navigation and control keys which we can “press” using our mouse or
keyboard to generate events for our applications. 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 that you can access from our 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 our development machine.
• In short Android Emulator tool helps to start the emulator from the command line.
2.5 DALVIK VIRTUAL MACHINE (DVM)
• Dalvik is a register-based virtual machine that’s been optimized to ensure that a device can run
multiple instances efficiently.
• The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality including
security, threading, and process and memory management.
• It’s also possible to write C/C++ applications that run directly on the underlying Linux OS. While we
can do this, in most cases there’s no reason we should need to.
• Google selected Java as the language for developing Android applications, thereby it got away with
both JME and the JVM in favour of an alternate development target, the Dalvik virtual machine.
• Google have also chosen to use an alternative and limited implementation of the standard java
libraries. Both of these are unusual Java and effectively represent fork of the Java platform.
• The key figure in Google’s implementation of JVM is Dan Bornstein, 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 by half from a traditional .jar file.
• Android OS uses the Dalvik virtual machine with just-during-time compilation to run Dalvik
bytecode, which is frequentaly 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) compiler, in early releases. Android 2.3 has added JIT.
• Dalvik VM use 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 relies 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 DalvikVM, is based not
on Java byte code but on .dex files instead. This means we cannot directly execute Java byte code; we
have to start with java class files and then converts 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 complied to binary files before these binary files become resident on the
devices. Android provides special mechanisms to use this XML data.
Mobile Application Development 2.8 Installation and Configuration of Android

• Android programs are complied into .dex (Dalvik Executable) files, which are in turn zipped into a
single .apk file on the device .dex files can be created by automatically translating compiled
applications written in the Java Programming language.
• The android uses a particular virtual machine i.e. the Dalvik Virtual Machine (DVM) to run Java based
applications.
• Dalvik is a vital part of Android which is normally use don mobile devices such as mobile phones and
tablet computers, embedded devices for example smart TVs and media streamers etc.
• Dalvik use san own byte format i.e. Dalvik byte code which is different from Java byte code which is
different from Java byte code.
• So Java class files can not directly run on android, they need to get converted in the Dalvik byte code
format which is compiled by the Dex compiler.
.apk
.jar
.dex
.class
Header Magic Numbers Header
Magic Number
Vesion of Class file Checksum
format SHA-1
Heterogeneo Strings
Signature other
Constant Pool us Constant Constant Pool
Pool
Type/Class
Access Flags This Constant Pool
Class Super class Class
Interfaces
Field constant
Field Pool
Constant Pool
Method
Method
Constant Pool
Methods
Class
Definitions
Attributes Attributes Field List

Code Header
.class
Local Variables

.class

Fig. 2.5: Android Dalvik Virtual Machine (DVM)


1. File Header: Dex files start the simple header with some checksums and offsets to other structures.
2. Notes: All non-string fields are stored in little-endian format. It would appear that the checksum and
signature fileds are assumed to be zero when calculating the checksum and signature.
3. String Table: This table stores the length and offsets for every sting in the Dex file including string
constants, class names, variable names and more. Class List
4. Class List: A list of all classes referenced or contained in this dex file.
Mobile Application Development 2.9 Installation and Configuration of Android

5. Field Table: A table of fields of all classes defined in this dex file.
6. Method Table: A table of methods of all classes in this dex file.
7. Class Definition Table: A table of class definition for all classes either defined in this dex file or has
a method or field accessed by code ij this dex file.
8. Filed List: Stores data for pre-initialized fields in a class. The list is formed of a 32-bit integer
containing the number of entries followed by the entries themselves.
9. Method List: A list of methods for a particular class. Begins with a 32 bit integer that conatins the
number of items in the list.
10. Code Header: This header contains the information about the code that implements the methods.
11. Local Variable List: A list of variables for a particular method. Begins with a 32 bit integer that
contains the number of items in the list.
2.5.1 Difference between Java Virtual Machine (JVM) and Dalvik Virtual
Machine (DVM)
• Fig. 2.6 shows JVM and DVM with difference them.

Java Source Code Java Source Code


Java Compiler

Java Compiler

Java Byte Code Java Byte Code


Dex Compiler

Java Byte Code


by JVM
Dalvik Byte Code

Dalvik Executable
by DVM

• Following table differentiate JVM and DVM:


Sr. No. JVM DVM
1. JVM supports multiple operating systems. DVM supports only Android Operating System.
Mobile Application Development 2.10 Installation and Configuration of Android

2. JVM forms separate classes in separate DVM forms multiple class in .dex byte code file.
.class byte code files.
3. It is based on stack based virtual machine It is based on Register based virtual machine
architecture. architecture.
4. JVM runs on more memory. DVM runs on less memory.
5. The executable format of JVM is JAR. The executable format of DVM is APK.
6. JVM has different constant pools. DVM has common constant pool.
7. It runs .class byte code directly. The .class byte codes are optimized to .odex
format before executing in DVM.

2.6 STEPS TO INSTALL AND CONFIGURE ANDROID STUDIO AND SDK


• Before any work can begin on the development of an Android application, the first step is to
configure a computer system to act as the development platform. This involves a number of steps
consisting of installing the Android Studio Integrated Development Environment (IDE) which also
includes the Android Software Development Kit (SDK) and OpenJDK Java development environment.
2.6.1 System Requirements
• Android application development may be performed on any of the following system types:
1. Windows 7/8/10 (32-bit or 64-bit).
2. MAC OS 10.10 or later (Intel based systems only).
3. Linux systems with version 2.19 or later of GNU C Library (glibc).
4. Minimum of 3GB of RAM (8GB is preferred).
5. Approximately 4GB of available disk space.
6. 1280 × 800 minimum screen resolution.
2.6.2 Downloading the Android Studio Package
• Most of the work involved in developing applications for Android will be performed using the
Android Studio environment. The content and examples in this book were created based on Android
Studio version 3.2 which, at the time writing is the current version.
• Android Studio is, however, subject to frequent updates so a newer version may have been released
since this book was published.
• The latest release of Android Studio may be downloaded from the primary download page which can
be found at the following URL:
• If this page provides instructions for downloading a newer version of Android Studio it is important
to note that there may be some minor differences between this book and the software. A web search
for Android Studio 3.2 should provide the option to download the older version in the event that
these differences become a problem.
2.6.3 Installing Android Studio
• Once, downloaded, the exact steps to install Android Studio differ depending on the operating
system on which the installation is being performed.
2.6.3.1 Installation on Windows
• Locate the downloaded Android Studio installation executable file, (named android-studio-ide-
<version>-windows.exe) in a Windows Explorer window and double-click on it to start the
installation process, clicking the Yes button in the User Account Control dialog if it appears.
• Once, the Android Studio setup wizard appears, work through the various screens to configure the
installation to meet your requirements in terms of the file system location into which Android
Mobile Application Development 2.11 Installation and Configuration of Android

Studio should be installed and whether or not it should be made available to other users of the
system.
• When prompted to select the components to install, make sure that the Android Studio, Android SDK
and Android Virtual Device options are all selected.
• Although there are no strict rules on where Android Studio should be installed on the system, the
remainder of this book will assume that the installation was performed into C:\Program
Files\Android\Android Studio and that the Android SDK packages have been installed into the user’s
AppData\Local\Android\sdksub-folder. Once, the options have been configured, click on the Install
button to begin the installation process.
• On versions of Windows with a Start menu, the newly installed Android Studio can be launched
from the entry added to that menu during the installation. The executable may be pinned to the task
bar for easy access by navigating to the Android Studio\bin directory, right-clicking on the
executable and selecting the Pin to Taskbar menu option. Note that the executable is provided in 32-
bit (studio) and 64-bit (studio64) executable versions. If you are running a 32-bit system be sure to
use the studio executable.
2.6.3.2 Installation on MAC OS
• Android Studio for macOS is downloaded in the form of a disk image (.dmg) file. Once the android-
studio-ide-<version>-mac.dmgfile has been downloaded, locate it in a Finder window and double-
click on it to open it as shown in Fig. 2.7.

Fig. 2.7
• To install the package, simply drag the Android Studio icon and drop it onto the Applications folder.
The Android Studio package will then be installed into the Applications folder of the system, a
process which will typically take a few minutes to complete.
• To launch Android Studio, locate the executable in the Applications folder using a Finder window
and double-click on it.
• For future easier access to the tool, drag the Android Studio icon from the Finder window and drop it
onto the dock.
2.6.3.3 Installation on Linux
• Having downloaded the Linux Android Studio package, open a terminal window, change directory to
the location where Android Studio is to be installed and execute the following command:
unzip /<path to package>/android-studio-ide-<version>-linux.zip
• Note that the Android Studio bundle will be installed into a sub-directory named android-studio.
Assuming, therefore, that the above command was executed in /home/demo, the software packages
will be unpacked into /home/demo/android-studio.
Mobile Application Development 2.12 Installation and Configuration of Android

• To launch Android Studio, open a terminal window, change directory to the android-studio/bin sub-
directory and execute the following command:
./studio.sh
• When running on a 64-bit Linux system, it will be necessary to install some 32-bit support libraries
before Android Studio will run. On Ubuntu these libraries can be installed using the following
command:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
• On RedHat and Fedora based 64-bit systems, use the following command:
sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686
2.6.4 The Android Studio Setup Wizard
• The first time that Android Studio is launched after being installed, a dialog will appear providing
the option to import settings from a previous Android Studio version.
• If we have settings from a previous version and would like to import them into the latest installation,
select the appropriate option and location. Alternatively, indicate that we do not need to import any
previous settings and click on the OK button to proceed.
• Next, the setup wizard may appear as shown in Fig. 2.8 though this dialog does not appear on all
platforms:

Fig. 2.8
• If the wizard appears, click on the Next button, choose the Standard installation option and click on
Next once again.
• Android Studio will proceed to download and configure the latest Android SDK and some additional
components and packages. Once this process has completed, click on the Finish button in the
Downloading Components dialog at which point the Welcome to Android Studio screen should then
appear:
Mobile Application Development 2.13 Installation and Configuration of Android

Fig. 2.9
2.6.5 Installing Additional Android SDK Packages
• The steps performed so far have installed Java, the Android Studio IDE and the current set of default
Android SDK packages. Before proceeding, it is worth taking some time to verify which packages are
installed and to install any missing or updated packages.
• This task can be performed using the Android SDK Settings screen, which may be launched from
within the Android Studio tool by selecting the Configure → SDK Manager option from within the
Android Studio welcome dialog. Once invoked, the Android SDK screen of the default settings dialog
will appear as shown in Fig. 2.10

Fig. 2.10
• The Android SDK has been installed. To install older versions of the Android SDK simply select the
checkboxes corresponding to the versions and click on the Apply button.
• It is also possible that updates will be listed as being available for the latest SDK. To access detailed
information about the packages that are available for update, enable the Show Package Details
option located in the lower right-hand corner of the screen. This will display information similar to
that shown in Fig. 2.11.
Mobile Application Development 2.14 Installation and Configuration of Android

Fig. 2.11
• The Fig. 2.11 highlights the availability of an update. To install the updates, enable the checkbox to
the left of the item name and click on the Apply button.
• In addition to the Android SDK packages, a number of tools are also installed for building Android
applications. To view the currently installed packages and check for updates, remain within the SDK
settings screen and select the SDK Tools tab as shown in Fig. 2.12.

Fig. 2.12
• Within the Android SDK Tools screen, make sure that the following packages are listed as Installed in
the Status column:
1. Android SDK Build-Tools.
2. Android Emulator.
3. Android SDK Platform-Tools.
4. Android SDK Tools.
5. Google Play Services.
6. Instant Apps Development SDK.
7. Intel x86 Emulator Accelerator (HAXM installer).
8. ConstraintLayout for Android.
9. Solver for ConstraintLayout.
10. Android Support Repository.
11. Google Repository.
12. Google USB Driver (Windows only).
• In the event that any of the above packages are listed as Not Installed or requiring an update, simply
select the checkboxes next to those packages and click on the Apply button to initiate the installation
process.
Mobile Application Development 2.15 Installation and Configuration of Android

• Once, the installation is complete, review the package list and make sure that the selected packages
are now listed as Installed in the Status column. If any are listed as Not installed, make sure they are
selected and click on the Apply button again.
2.6.6 Making the Android SDK Tools Command-line Accessible
• Most of the time, the underlying tools of the Android SDK will be accessed from within the Android
Studio environment. That being said, however, there will also be instances where it will be useful to
be able to invoke those tools from a command prompt or terminal window. In order for the operating
system on which you are developing to be able to find these tools, it will be necessary to add them to
the system’s PATH environment variable.
• Regardless of operating system, the PATH variable needs to be configured to include the following
paths (where <path_to_android_sdk_installation>represents the file system location into which the
Android SDK was installed):
<path_to_android_sdk_installation>/sdk/tools
<path_to_android_sdk_installation>/sdk/tools/bin
<path_to_android_sdk_installation>/sdk/platform-tools
• The location of the SDK on your system can be identified by launching the SDK Manager and
referring to the Android SDK Location: field located at the top of the settings panel as highlighted in
Fig. 2.13.

Fig. 2.13
• Once, the location of the SDK has been identified, the steps to add this to the PATH variable are
operating system dependent:
2.6.6.1 Windows 7
• Right-click on Computer in the desktop start menu and select Properties from the resulting menu.
• In the properties panel, select the Advanced System Settings link and, in the resulting dialog, click
on the Environment Variables… button.
• In the Environment Variables dialog, locate the Path variable in the System variables list, select it
and click on Edit…. Locate the end of the current variable value string and append the path to the
Android platform tools to the end, using a semicolon to separate the path from the preceding values.
For example, assuming the Android SDK was installed into C:\Users\demo\AppData\Local\
Android\sdk, the following would be appended to the end of the current Path value:
;C:\Users\demo\AppData\Local\Android\sdk\platform-tools;
C:\Users\demo\AppData\Local\Android\sdk\tools;
C:\Users\demo\AppData\Local\Android\sdk\tools\bin
• Click on OK in each dialog box and close the system properties control panel.
• Once, the above steps are complete, verify that the path is correctly set by opening a Command
Prompt window (Start -> All Programs -> Accessories -> Command Prompt) and at the prompt enter:
echo %Path%
• The returned path variable value should include the paths to the Android SDK platform tools folders.
Verify that the platform-tools value is correct by attempting to run the adb tool as follows:
Mobile Application Development 2.16 Installation and Configuration of Android

adb
• The tool should output a list of command line options when executed.
• Similarly, check the tools path setting by attempting to launch the AVD Manager command line tool
(don’t worry if the avdmanager tool reports a problem with Java - this will be addressed later):
avdmanager
• In the event that a message similar to the following message appears for one or both of the
commands, it is most likely that an incorrect path was appended to the Path environment variable:
'adb' is not recognized as an internal or external command, operable program or batch file.
2.6.6.2 Windows 8.1
• On the start screen, move the mouse to the bottom right-hand corner of the screen and select Search
from the resulting menu. In the search box, enter Control Panel. When the Control Panel icon
appears in the results area, click on it to launch the tool on the desktop.
• Within the Control Panel, use the Category menu to change the display to Large Icons. From the list
of icons select the one labeled System.
• Follow the steps outlined for Windows 7.
• Open the command prompt window (move the mouse to the bottom right-hand corner of the screen,
select the Search option and enter cmd into the search box). Select Command Prompt from the
search results.
• Within the Command Prompt window, enter:
echo %Path%
• The returned path variable value should include the paths to the Android SDK platform tools folders.
Verify that the platform-tools value is correct by attempting to run the adbtool as follows:
adb
• The tool should output a list of command line options when executed.
• Similarly, check the tools path setting by attempting to run the AVD Manager command line tool
(don’t worry if the avdmanager tool reports a problem with Java - this will be addressed later):
avdmanager
• In the event that a message similar to the following message appears for one or both of the
commands, it is mostlikely that an incorrect path was appended to the Path environment variable:
• 'adb' is not recognized as an internal or external command, operable program or batch file.
2.6.6.3 Windows 10
• Right-click on the Start menu, select Settings from the resulting menu and enter “Edit the system
environment variables” into the Find a setting text field.
• In the System Properties dialog, click the Environment Variables... button. Follow the steps outlined
for Windows 7.
2.6.6.4 Linux
• On Linux, this configuration can typically be achieved by adding a command to the .bashrc file in
your home directory (specifics may differ depending on the particular Linux distribution in use).
• Assuming that the Android SDK bundle package was installed into /home/demo/Android/sdk, the
export line in the .bashrcfile would read as follows:
• export PATH=/home/demo/Android/sdk/platform-tools:/home/demo/Android/sdk/tools:/home
/demo/Android/sdk/tools/bin:/home/demo/android-studio/bin:$PATH
• Note also that the above command adds the android-studio/bin directory to the PATH variable. This
will enable the studio.sh script to be executed regardless of the current directory within a terminal
window.
Mobile Application Development 2.17 Installation and Configuration of Android

2.6.6.5 MAC OS
• A number of techniques may be employed to modify the $PATH environment variable on macOS.
Arguably the cleanest method is to add a new file in the /etc/paths.ddirectory containing the paths
to be added to $PATH.
• Assuming an Android SDK installation location of /Users/demo/Library/ Android/sdk, the path may
be configured by creating a new file named android-sdkin the /etc/paths.ddirectory containing the
following lines:
/Users/demo/Library/Android/sdk/tools
/Users/demo/Library/Android/sdk/tools/bin
/Users/demo/Library/Android/sdk/platform-tools
• Note that since this is a system directory it will be necessary to use the sudocommand when creating
the file. For example:
sudo vi /etc/paths.d/android-sdk
2.7 Updating Android Studio and the SDK
• From time to time new versions of Android Studio and the Android SDK are released. New versions
of the SDK are installed using the Android SDK Manager. Android Studio will typically notify you
when an update is ready to be installed.
• To manually check for Android Studio updates, click on the Configure → Check for Update menu
option within the Android Studio welcome screen, or use the Help → Check for Update menu option
accessible from within the Android Studio main window.

Practice Questions
1. What is OS? Explain OS requirements for Android.
2. What is JDK?
3. What is SDK?
4. How to install Android Studio?
5. Describe DVM with diagram.
6. What is JVM? Compare JVM and DVM.
7. Explain the term emulator in detail.
8. What is AVD?
9. What is ADT? Describe in detail.
10. Differentiate between JDK and SDK.
11. Explain how to configure Android studio and SDK.

You might also like