Setting Up Android Environment.
1. Install Java Development Kit (JDK).
Download Java
Development Kit (JDK) from Oracle Java website and install it in
your machine.
What is JDK.
Java Developer Kit
contains tools needed to develop the Java programs, and JRE to run
the programs. The tools include compiler (javac.exe), Java
application launcher (java.exe), Appletviewer, etc…
Compiler converts
java code into byte code. Java application launcher opens a JRE,
loads the class, and invokes its main method.
You need JDK, if
at all you want to write your own programs, and to compile them. For
running java programs, JRE is sufficient.
What is JRE.
JRE = JVM + Java
Packages Classes(like util, math, lang, awt,swing etc)+runtime
libraries.
Java Runtime
Environment contains JVM, class libraries, and other supporting
files. It does not contain any development tools such as compiler,
debugger, etc. Actually JVM runs the program, and it uses the class
libraries, and other supporting files provided in JRE. If you want
to run any java program, you need to have JRE installed in the
system.
What is JVM.
As we all aware
when we compile a Java file, output is not an "exe" but it’s a
".class" file. ".class" file consists of Java byte codes which are
understandable by JVM. Java Virtual Machine interprets the byte code
into the machine code depending upon the underlying operating system
and hardware combination. It is responsible for all the things like
garbage collection, array bounds checking, etc… JVM is platform
dependent.
2. Setting up Android SDK.
We require three
thing for Android Development.
- Android SDK.
- Eclipse IDE.
- ADT (Android Development Tool).
Android SDK.
The Android SDK
provides you the API libraries and developer tools necessary to
build, test, and debug apps for Android.
Eclipse IDE.
IDE standards for
Integrated Development Environment. It's tool helps for developing
application. IDE's are designed to maximize programmer productivity
and helps the developer to write less number of code.
Android Development Tool (ADT).
ADT (Android
Developer Tools) is a plugin for Eclipse that provides a suite of
tools that are integrated with the Eclipse IDE. It offers you access
to many features that help you develop Android applications quickly.
2.1. Download SDK with ADT Bundle (If you
don't have a Eclipse IDE).
If you're a new
Android developer, we recommend you download the ADT Bundle to
quickly start developing apps. It includes the essential Android SDK
components and a version of the Eclipse IDE with built-in ADT
(Android Developer Tools) to streamline your Android app
development.
Get SDK and ADT Bundle from https://developer.android.com/sdk/index.html
With a single
download, the ADT Bundle includes everything you need to begin
developing apps:
- Eclipse + ADT Plugin.
- Android SDK Tools
- Android Platform-tools.
- The latest Android Platform.
- The latest Android System image for the emulator.
With the single
download we got Eclipse with ADT and Android SDK. We can double
click on Eclipse and start developing application.
2.2. Setting Up Android SDK with Existing
Eclipse IDE.
If you already
have an IDE you want to use for Android app development, setting up
a new SDK requires that you download the SDK Tools, then select
additional Android SDK packages to install (such as the Android
platform and system image). If you'll be using an existing version
of Eclipse, then you can add the ADT plugin to it.
Download SDK.
Download SDK from https://developer.android.com/sdk/index.html
Once Download has been completed, In the Android SDK folder we will
have SDK Manager.exe run this executable file. We will get
Android SDK Manager Window choose required Platforms and Tools that
we need to install and click install.
Configure ADT to your Eclipse IDE.
In this step we
are going to integrate Android SDK with Eclipse IDE, using the ADT
(Android Development Tools) plugin.
- Open Eclipse and select Help -> Install New Software.
- Click ADD to add Android ADT Repository.
- In Add Repository window give Name as "Android Sdk"(you can give any name you want).
- And Give Location as "https://dl-ssl.google.com/android/eclipse/".
Select Developer
Tools and Install it. Once it is complete then Android ADT Plugin
has been configured to our eclipse.
Integrate Android SDK with Eclipse IDE
using ADT.
After installing
the ADT plugin, you have to define the location of the Android SDK
in Android preferences in Eclipse:
- Select Window -> Preferences… to open the Preferences panel.
- Select Android from the left panel.
- For the SDK Location in the main panel, click Browse… and locate your downloaded SDK directory.
- Click Apply, then OK.
Android SDK and
ADT has been integrated with our Eclipse IDE, hence we are ready to
develop our First Android Application.
References
https://developer.android.com/sdk/index.html
http://stackoverflow.com/questions/11547458/what-is-differences-between-jvm-jdk-jre-openjdk
http://theopentutorials.com/tutorials/android/installing-android-sdk-and-eclipse-adt-plugin/