You are on page 1of 14

Introduction to Android

Lab - 1
Android powers hundreds of millions of mobile devices in more than 190 countries around
the world. It's the largest installed base of any mobile platform and growing fast—every
day another million user’s power up their Android devices for the first time and start
looking for apps, games, and other digital content. Android gives you a world -class
platform for creating apps and games for Android users everywhere, as well as an open
marketplace for distributing to them instantly

Global partnerships and large installed


base
Building on the contributions of the open-source Linux community and more than 300
hardware, software, and carrier partners, Android has rapidly become the fastest-growing
mobile OS.

Android’s openness has made it a Every day more than 1 million


favorite for consumers and developers new Android devices are
alike, driving strong growth in app activated worldwide
consumption. Android users download
more than 1.5 billion apps and games from Google Play each.
With its partners, Android is continuously pushing the boundaries of hardware and
software forward to bring new capabilities to users and developers. For developers,
Android innovation lets you build powerful, differentiated applications th at use the latest
mobile technologies.

Powerful development framework


Android gives you everything you need to build best-in-class app experiences. It gives you
a single application model that lets you deploy your apps broadly to hundreds of millions
of users across a wide range of devices—from
phones to tablets and beyond. Easily optimize a single
Android also gives you tools for creating apps binary for phones, tablets,
that look great and take advantage of the and other devices
hardware capabilities available on each device.
It automatically adapts your UI to look its best on each device, while giving you as much
control as you want over your UI on different device types.

For example, you can create a single app binary that's optimized for both phone and tablet
form factors. You declare your UI in lightweight sets of XML resources, one set for parts of
the UI that are common to all form factors and other sets for optimizations specific to
phones or tablets. At runtime, Android applies the correct resource sets based on its screen
size, density, locale, and so on.

To help you develop efficiently, the Android Developer Tools offer a full Java IDE with
advanced features for developing, debugging, and packaging Android apps. Using the IDE,
you can develop on any available Android device or create virtual devices that emulate
any hardware configuration.

Open marketplace for distributing your


apps

1.5 billion downloads a month


and growing. Get your apps in
Google Play is the premier marketplace for front of millions of users at
selling and distributing Android apps. When Google's scale.
you publish an app on Google Play, you
reach the huge installed base of Android.

As an open marketplace, Google Play puts you in control of how you sell your products.
You can publish whenever you want, as often as you want, and to the customers you want.
You can distribute broadly to all markets and devices or focus on specific segments,
devices, or ranges of hardware capabilities.

You can monetize in the way that works best for your
business—priced or free, with in-app products or
subscriptions—for highest engagement and revenues. You also
have complete control of the pricing for your apps and in-app
products and can set or change prices in any supported
currency at any time.

Beyond growing your customer base, Google Play helps you


build visibility and engagement across your apps and brand. As
your apps rise in popularity, Google Play gives them higher
placement in weekly "top" charts and rankings, and for the best
apps promotional slots in curated collections.

Preinstalled on hundreds of millions of Android devices around


the world, Google Play can be a growth engine for your
business.

Get Started
Everything you need to start developing apps for Android is
available here on developer.android.com. You'll find everything
from the developer SDK, API documentation, and design guidelines, to information about the
current device landscape and how you can distribute and monetize your app.

No two apps are built in the same way, but we've structured the information you need to build an
app into the following three sections that represent the general order for app devel opment.

3. Distribute
Now your app is complete. You've built it to support a variety of screen sizes and densities, and
tested it on the Android emulator and on real devices. You're ready to ship your app.

How you proceed depends on a variety of factors, such as your monetization strategy and which
types of devices your app supports.

2. Develop

Once your design is finalized, all you need are the tools to turn your app ideas into reality.
Android's framework provides you the APIs to build apps that take full advantage of device
hardware, connected accessory devices, the Internet, software features, and more. With the
power of Android, there's no limit to the power of your apps.

3. Distribute

Now your app is complete. You've built it to support a variety of screen sizes and densities, and
tested it on the Android emulator and on real devices. You're ready to ship your app.

How you proceed depends on a variety of factors, such as your monetization strategy and which
types of devices your app supports.
Android Architecture
Linux kernel

At the bottom of the


layers is Linux - Linux 2.6
with approximately 115
patches. This provides
basic system functionality
like process management,
memory management,
device management like
camera, keypad, display
etc.

Libraries

On top of Linux kernel


there is a set of libraries including open-source Web browser engine WebKit, well known library
libc, SQLite database which is a useful repository for storage and sharing of application data,
libraries to play and record audio and video, SSL libraries responsible for Internet security etc.

Android Runtime

This is the third section of the architecture and available on the second layer from the bottom.
This section provides a key component called Dalvik Virtual Machine which is a kind of Java
Virtual Machine specially designed and optimized for Android. The Dalvik VM makes use of
Linux core features like memory management and multi-threading, which is intrinsic in the Java
language. The Android runtime also provides a set of core libraries which enable Android
application developers to write Android applications using standard Java programming
language.

Application Framework

The Application Framework layer provides many higher-level services to applications in the form
of Java classes. Application developers are allowed to make use of these services in their
applications.

Application
You will find all the Android application at the top layer. You will write your application to be
installed on this layer only. Examples of such applications are Contacts Books, Browser, and
Games etc.

System Requirements
Operating Systems

Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)

Mac OS X 10.5.8 or later (x86 only)

Linux (tested on Ubuntu Linux, Lucid Lynx)

GNU C Library (glibc) 2.7 or later is required.

On Ubuntu Linux, version 8.04 or later is required.

64-bit distributions must be capable of running 32-bit applications.

Eclipse IDE

Eclipse 3.7.2 (Indigo) or greater

Note: Eclipse 3.6 (Helios) is no longer supported with the latest version of ADT.

Eclipse JDT plugin (included in most Eclipse IDE packages)

JDK 6 (JRE alone is not sufficient)

Android Development Tools plugin (recommended)

Not compatible with GNU Compiler for Java (gcj)

Other development environments

JDK 6 (JRE alone is not sufficient)

Apache Ant 1.8 or later

Not compatible with Gnu Compiler for Java (gcj)

Note: Some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which
are not supported for Android development.

Setting up the ADT Bundle


The ADT Bundle provides everything you need to start developing apps, including a version of
the Eclipse IDE with built-in ADT (Android Developer Tools) to streamline your Android app
development. If you haven't already, go download the Android ADT Bundle. (If you downloaded
the SDK Tools only, for use with an existing IDE, you should instead read Setting Up an Existing
IDE.)

Install the SDK and Eclipse IDE

1. Unpack the ZIP file (named adt-bundle-<os_platform>.zip) and save it to an appropriate


location, such as a "Development" directory in your home directory.
2. Open the adt-bundle-<os_platform>/eclipse/ directory and launch eclipse.

That's it! The IDE is already loaded with the Android Developer Tools plugin and the SDK is
ready to go. To start developing, read Building Your First App.

Caution: Do not move any of the files or directories from the adt-bundle-<os_platform>
directory. If you move the eclipse or sdk directory, ADT will not be able to locate the SDK and
you'll need to manually update the ADT preferences.

Additional information

As you continue developing apps, you may need to install additional versions of Android for the
emulator and other packages such as the library for Google Play In -app Billing. To install more
packages, use the SDK Manager.

Everything you need to develop Android apps is on this web site, including design guidelines,
developer training, API reference, and information about how you can distribute your app. For
additional resources about developing and distributing your app, see the Developer Support
Resources.

Setting Up an Existing IDE

You should have already downloaded the Android SDK Tools. (If you downloaded the ADT
Bundle, you should instead read Setting Up the ADT Bundle.)

The SDK Tools package is not the complete SDK environment. It includes only the core SDK
tools, which you can use to download the rest of the SDK packages (such as the latest system
image).

Getting started on Windows

Your download package is an executable file that starts an installer. The installer checks your
machine for required tools, such as the proper Java SE Development Kit (JDK) and installs it if
necessary. The installer then saves the Android SDK Tools into a default location (or you can
specify the location).

1. Double-click the executable (.exe file) to start the install.


2. Make a note of the name and location in which it saves the SDK on your system—you will
need to refer to the SDK directory later, when setting up the ADT plugin and when using the
SDK tools from the command line.
3. Once the installation completes, the installer offers to start the Android SDK Manager. If
you'll be using Eclipse, do not start the Android SDK Manager, and instead move on to
Installing the Eclipse Plugin.

If you're using a different IDE, start the SDK Manager and read Adding Platforms and Packages.

Download the ADT Plugin

1. Start Eclipse, then select Help > Install New Software.


2. Click Add, in the top-right corner.
3. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the
following URL for the Location:

https://dl-ssl.google.com/android/eclipse/

4. Click OK.
If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of
"https" (https is preferred for security reasons).
5. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
6. In the next window, you'll see a list of the tools to be downloaded. Click Next.
7. Read and accept the license agreements, then click Finish.
If you get a security warning saying that the authenticity or validity of the software can't be
established, click OK.
8. When the installation completes, restart Eclipse.

Configure the ADT Plugin

Once Eclipse restarts, you must specify the location of your Android SDK directory:

1. In the "Welcome to Android Development" window that appears, select Use existing SDKs.
2. Browse and select the location of the Android SDK directory you recently downloaded and
unpacked.
3. Click Next.
Your Eclipse IDE is now set up to develop Android apps, but you need to add the latest SDK
platform tools and an Android platform to your environment. To get these packages for your
SDK, continue to Adding Platforms and Packages.

Adding Platforms and Packages

The Android SDK separates tools, platforms, and other componen ts into packages you can
download using the Android SDK Manager. The original SDK package you've downloaded
includes only the SDK Tools. To develop an Android app, you also need to download at least one
Android platform and the latest SDK Platform-tools.

1. Launch the SDK Manager.

If you've used the Windows installer to install the SDK tools, you should already have the
Android SDK Manager open. Otherwise, you can launch the Android SDK Manager in one of
the following ways:

• On Windows, double-click the SDK Manager.exe file at the root of the Android SDK
directory.
• On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK,
then execute android sdk.
2. The SDK Manager shows all the SDK packages available for you to add to your Android SDK.
As a minimum configuration for your SDK, we recommend you install the following:
o The latest Tools packages (check the Tools folder).
o The latest version of Android (check the first Android folder).
o The Android Support Library (open the Extras folder and check Android Support
Library).
o Once you've chosen your packages, click Install. The Android SDK Manager installs
the selected packages into your Android SDK environment.
Creating Android Virtual Devices (AVDs) for Use in the Android Emulator

The Android emulator, included in the Android SDK, allows you to run Android apps in a simulated
environment on your computer rather than on an actual Android device. Before running an app
in the emulator, you must create an Android Virtual Device (AVD) which defines the characteristics
of the device on which you want to test, including the screen size in pixels, the pixel density, the
physical size of the screen, size of the SD card for data storage and more.

1. Open Eclipse.
2. Select Window > AVD Manager to display the Android Virtual Device Manager window
3. Click New to display the
Create new Android Virtual
Device (AVD) window, then
configure the options as shown
and click Create AVD. These
settings simulate the primary
Android phone that we used for
testing—the original Samsung
Nexus S, which was running
Android 2.3.3 at the time of this
writing. Each AVD you create has
many other options specified in
its config.ini. You can modify this
file as described at.

1. Type the name of the device. E.g NexusS,


Gingerbread or any text you prefer.
2. Select the device size to be display on the
user screen. 3.7” WVGA (480 x 800: hdpi)
3. Select the target API in our course we will
select Android 3.2 – API Level 13
4. Check snapshot checkbox in Emulation
options. It will speed up the execution of
emulator.
5. Click ok to create your defined emulator.
6. In a new window click start
7. If you want to reduce the size of your
emulator so that it can display properly on
your monitor screen, then check scale
display to real size checkbox.
8. Check launch from snapshot and save
snapshot checkboxes and click Launch
button.
9. The emulator will be launched as soon in
the figure.
Launch Options

Emulator
Tasks (15 marks)

• Intro about Android


• Installing Android Studio steps:
o Setting up JDK
o Setting Environment Variables
o Information about Hyper V enabling
o Installing Andoid Studio

You might also like