Android Development Environment
Perquisites of Android Development .
To get started building Android
apps, download the Eclipse for java support , JDK 1.6 or later and ADT Plugin From
this page, click the link to download the Android SDK. The
button on the right should indicate the ADT bundle
for your operating system, Windows, Mac, or Linux. When
you click the button, you'll be shown the
terms and conditions, the license agreement for this free software.
After reading through the terms and
conditions, if you
agree with them, check the appropriate check box. Then,
if you're working on Windows, you'll need to
choose either 32 or 64 bit software. If
you're working on Mac OS 10, you'll only have 64 bit software available. I'm
working on a 64 bit version of Windows, so
I'll choose 64 bit and click to download link. You
can download the bundle anywhere on your desktop. It'll
be downloaded as a fairly large ZIP file.
To start up Eclipse for the first time, double
click Eclipse with the Eclipse icon. When
you launch Eclipse, you'll be asked to choose a work space. In
Eclipse vocabulary, a workspace is a folder that keeps track of your projects. Typically,
you'll place the projects as subfolders within the workspace. But
you don't have to. They
can actually go anywhere on your hard disk.The default location for the
workspace folder is named
workspace. And
on Windows, it's placed under the home directory,
and on Mac under the documents directory.
You can accept this default name, or you can
use your own custom name. I'll
create a work space named AndroidSDKws for work space. I'll
click OK, and that starts up Eclipse. The
first time you open Eclipse with the ADT, you'll
see this screen, asking if you want to contribute usage statistics. This
is an anonymous process, and is completely optional. After
choosing your favorite option, click Finish, and
that'll take you to the welcome screen.
This screen has a few links to various
documentation resources. And
also a button that you could click at this point to start your first Adroid
app. I
won't do that right now. I'll
be showing you how to create your first app in a few movies. So
I'll close the welcome screen and that takes me to the eclipse layout. So
if you've gotten this far, and you're successfully runningEclipse with the ADT
you're ready for the next step. Getting
to know the Eclipse environment and setting up the SDK.
Downloading all the tools you'll need to build
your android apps. iI explained below how to Download and install the each and every tool for running and developing your applications.
JDK Installation
Make sure that JDK is installed on the system and path fro JDK is set .
You can download the JDK 6 or above from the Following link :
http://www.oracle.com/technetwork/java/javase/downloads/index.html
ADT installation
Download and Install the ADT(Android Developer Tool) from the following link given below :
http://developer.android.com/tools/sdk/eclipse-adt.html
4.Eclipse IDE
Download the eclipse IDE for Java from the given link as per your system support i.e. 32 bit or 64 bit os
https://eclipse.org/downloads/
Setting up of Development Environment
Now your system is ready for the android application development. you need to follow the given steps for creating the development environment.
Set the path of JDK for windows
1. In Windows
Windows XP
- Select Start, select Control Panel. double click System, and select the Advanced tab.
- Click Environment Variables. In the section System Variables, find the
PATHenvironment variable and select it. Click Edit. If thePATHenvironment variable does not exist, clickNew. - In the Edit System Variable (or New System Variable) window, specify the value of the
PATHenvironment variable. Click OK. Close all remaining windows by clicking OK.
Windows Vista:
- From the desktop, right click the My Computer icon.
- Choose Properties from the context menu.
- Click the Advanced tab (Advanced system settings link in Vista).
- Click Environment Variables. In the section System Variables, find the
PATHenvironment variable and select it. Click Edit. If thePATHenvironment variable does not exist, clickNew. - In the Edit System Variable (or New System Variable) window, specify the value of the
PATHenvironment variable. Click OK. Close all remaining windows by clicking OK.
Windows 7:
- From the desktop, right click the Computer icon.
- Choose Properties from the context menu.
- Click the Advanced system settings link.
- Click Environment Variables. In the section System Variables, find the
PATHenvironment variable and select it. Click Edit. If thePATHenvironment variable does not exist, clickNew. - In the Edit System Variable (or New System Variable) window, specify the value of the
PATHenvironment variable. Click OK. Close all remaining windows by clicking OK.
Once you set the path of JDK you need to follow the following steps :
1. Start Eclipse
2.Go to Help----->select Install new software----------> got to right hand side click on Add button
In Add button Dialog enter following
Name = ADT Plugin
Location = rar file or web Location of ADT plugin i.e. https://dl-ssl.google.com/android/eclipse/
3. Restart your Eclipse
4. Now your eclipse is ready for developing the android application.
Creating your
first app
Once you've created a virtual
device, or attached a device
for debugging, you're ready to create your first project. From
within eclipse, select File > New > Android Application Project.The application
name can be any string. Keep
it short, because it's going to appear as a
label on the device itself, to identify your app. If
you make this string too
long, it'll be truncated automatically. The
project name can be the same as the application name,
but it can't include any spaces or special characters.
The project name is only used by Eclipse, and
it won't affect the app itself. The
package name is very important. It's
a globally unique identifier for your app. And
to make it globally unique, most developers use their website
address, their domain name, in reverse domain notation. So
for example, for my personal applications, I might
use a package name that starts com.example. If you are Owing a domain then its easy for you to the name of your package by your domain name because nobody
else in the world is going to use that
package name, because you own that domain.
For this course, we'll use a generic package
name of com.example. That's
only used globally for training examples. These
apps won't be submitted to the Google
Play store or other application distribution channels. They're
only for training, so this is a good package name to use. But
for your apps, use your domain. Next
we'll set the SDKs.
The minimum required SDK represents the
earliest version of Android
that you're going to support with your app. It
defaults to Android 2.2. But
that version of the operating system has a very small market share these days. So,
the earliest version that I recommend supporting is Android 2.3, or
Gingerbread.
As
of the time of this recording, Gingerbread still had about 26%of the global
device market. If
you want to make your life a little easier though Change the minimum required SDK
to API 14, Android 4.0 or Ice Cream Sandwich.
By only supporting 4.0 and up, you eliminate a
lot of
extra coding and testing that you'd otherwise need to do. And
you'll see have a majority of the market available to you. The
target SDK, represents your primary operating system target. As
of the time of this recording in late 2013, Android 4.4 or Kit Kat had just been
released. Android
4.3 or the last version of Jelly Bean was really the
most common new version of the operating system on real devices.
It's up to you which target SDK to support. But
typically, I set this to the latest version
of Android, so I'll set it to KitKat. I'll
accept the default theme, but you can also experiment with the other built
in themes of Holo Dark and Holo Light, and I'll click Next. On
this screen, I'll leave all the options at
their defaults including Create custom launcher icon. And
then when I click Next, I'll be taken to a screen where I Configure the
Launcher Icon.
The launcher icon is a graphic that visually identifies
the app to the user on the device. The
default is a picture of Andy the android, but you'll want to customize
to some extent and this screen makes it easy to do that. You
can either choose Clipart by selecting Clipart and then clicking Choose, or you
can create a text based icon, I'll
use Clipart. I'll select that and click Choose. And
then, I'll select one of these graphics.
You can choose anything you like. This
is going to be a simple hello application. So,
I'll select just a picture of a head. And
I get this graphic, as my Launcher icon. Now
you can customize it. You
can indicate how much Additional Padding
you want, that resizes the graphic. I'll
leave it at the default of 0%. And
you can indicate whether you want to wrap the graphic in a Square or a Circle. I'll
select a Circle. And you can change the colors.
I'll click on the Foreground Color button. And
then, I'll chose a color. If
you have trouble getting to the color
selection dialogue try double-clicking on these buttons. And
you can also affect the Background Color, if
you prefer. I'll
once again set the padding, now that I have
a shape around the icon and I'll click Next. On
this screen, you indicate what your initial application looks like.The
applications appearance is controlled by something called an Activity. And
for first app, we'll use the default of a Blank Activity.
You could also select Fullscreen Activity, or
Master Detail Flow. But
those will create a lot more code than we want to look at right now. So
I'll select Blank Activity and click Next. And
I'll accept the defaults on this screen and click Finish. And
that creates my application. Now
to start the application and see how it will look on a device. Make
sure that you've opened a Java file. One
will open automatically for you, called MainActivity.java.
Then go to the Menu, and select Run, and
select Run again. The
first time you run any project, you'll be asked
what kind of launch configuration you want to use. Choose
this one. Run
as Android application, and click OK. Depending
on your system configuration, your app might automatically launch, and
that could happen if you only have one virtual device, or
one actual device attached to your computer. But
if you have more than one option, you might be prompted to choose a device.
I'm going to choose my AVD_for_Nexus_4, my
virtual device. If
you don't see it listed here, you might need to launch it from here. So,
I'll click that and click OK. Then
I'll use Alt+Tab and switch over to my device. If
I come to the lock screen,
I'll unlock it. And,
after just a moment, I should see the application running. I'll
go back a step, and I'll go to my application list, andhere's my Hello Android
application listed, I'll click it and run it again.
Now, I'll come back to the class MainActivity. And
I'll run again. This time, I'll go to the toolbar.This is the Run button. If
I wanted to just run, I would click the button. But
instead, I'm going edit my run configuration. I'll
click the down arrow, and choose Run Configurations. Then,
I'll click Target. And
I can indicate here, how I want to launch? I
can either select a preferred virtual device or I
can say always prompt me to pick a device.
I'll do that and click the Run button. And
this time, I'll choose my Nexus 5, which
is attached to my computer, and click OK. And
there's the same application running on the actual device. So
now, I've created my first app, and I've run it
both on a virtual device and on a real device. And
if you've gotten this far, you're in great shape. You're
ready to start learning the details of howto build Android apps that run on
Android devices from phones
to tablets and more.

