INSTALLING JAVA, ECLIPSE, AND ANDROID SDKs TO SETUP AN ANDROID DEVELOPMENT ENVIRONMENT
ABSTRACT
This document describe a process to install Eclipse, the necessary Android SDKs, and plug-ins that will allow you to develop, debug, and test Android applications. There are many different articles that have been written describing the installation process. I have culled these articles to produce the following process derived from the following sources primary sources among others:
-
The following document is one of the better documents that I have found. It assumes that you have already installed Java. It also refers to an older version of Eclipse than the one I am using. http://www.instructables.com/id/How-To-Setup-Eclipse-for-Android-App-Development/.
-
The following article talks about how to install the Android SDK http://www.androidauthority.com/how-to-install-android-sdk-software-development-kit-21137/. It’s a little bit dated and incomplete.
-
Some of the instructions from https://developer.google.com are useful. However, they are geared for development in Android Studio. However, they do explain how to install the Android SDKs and the SDK versions.
Key Terms -
The Android Software Development Kit (SDK) is the set of Android libraries needed to create Android applications.
-
The Android SDK Manager is the tool used to install different Android SDK versions on your computer. There are several SDK versions.
-
An Android Virtual Device (AVD) is an emulator with which you can run Android applications on Windows and other computers.
-
Eclipse is an integrated development environment with which you create Java, Android, and other applications. Mars is the current version of Eclipse.
-
Java is a programming language originally developed by Sun Microsystems. Android applications are written in Java.
Installation Overview
The installation protocol described in this document involves performing the following steps, in sequential order:
-
Install Java SE Development Kit 8uXX. Note that these builds are updated constantly. Substitute the current version number for XX.
-
Install Eclipse MARS. This is the current version of Eclipse
-
Download and install the Android SDK Manager and AVD Manager.
-
Install the necessary SDK packages (versions)
-
Connect the Android SDK Manager and AVD Manger to Eclipse.
-
Configure an emulator.
-
Test the development environment by creating a Hello World application.
Development Environment Options
As you develop Android applications, there a few options from which you can choose for the development environment.
-
You can run Eclipse, and install the required Android Software Development Kit (SDK), and the Android Development Tools (ADT). This is the option discussed in this document.
-
You can run Android Studio. This is Google’s preferred way of developing Android Apps. We do not use Android Studio in the COBA labs because some conflicts between the development environment and user profiles make it difficult to move workspaces from one machine to another. However, you can use Android Studio in this course if you like. However, be advised that it’s tricky to move projects from Android Studio to Eclipse, and back.
-
You can develop Android (and IOS) applications in C# using 3rd party development tools such as Xamarin. But Xamarin is not free beyond a trial period. There are other 3rd party tools too. Xamerin provides an interesting option because you develop applications in .NET using .NET languages such as C#.
Installing Java
First, Java must be installed in your computer. In addition, you must have the Java SE Development Kit. The JRE (runtime) edition will not work. Download it from the following URL:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
The version numbers are constantly changing. Download the 8uXX version. Any of the current versions should work. It’s here that you should also decide whether you want to run the 32 bit or 64 bit version of Java, and the subsequent Android tools. I have been using the 64 bit versions for my development but either should work fine.
-
Note that you must accept the license agreement before downloading the installer.
-
The installer is straight forward. You can accept all of the default installation options upon running the .exe file.
HANDS-ON ACTIVITY – Determining the Java version
There is a very simple test to determine whether Java is working or not.
-
Open a Command window and enter java –version. You should see version information similar to the following. The examples in this document are all configured for JRE 1.8.*. They should run on 1.7.* too.
Installing Eclipse (MARS)
This step describes how to install Eclipse. Eclipse is the development platform with which you will develop Java and Android applications in this course. In this regard, Eclipse fulfills the same role as Visual Studio. Note the following about the Eclipse installation:
-
Unlike most applications, prior versions of Eclipse were distributed as .zip files. You can just extract the .zip file to get a working version of Eclipse. You can continue to use this option for the MARS version if you choose.
-
The latest version of Eclipse has an installer. This installation document assumes that you are using the Eclipse installer.
-
To install many of the add-ins, you must run the program as the administrator.
-
This document also assumes that you install Eclipse in the default directory. I suggest that you do not change the path name. This will maximize portability from one computer to the next.
-
The following steps assume that you are downloading the MARS edition.
HANDS-ON ACTIVITY – Installing Eclipse
-
Download and run the installer from http://www.eclipse.org/downloads if you have not already done so. The following installation screen should appear.
-
Select the option Eclipse IDE for Java Developers.
-
In the steps that follow, I suggest you create a Start menu entry and a desktop shortcut.
-
When the installer finishes, Eclipse should start.
-
Exit Eclipse. If you are asked for a default workspace, select the default workspace, and then exit Eclipse.
Installing the Android SDK Manager
The Eclipse distribution that you just installed is now ready to develop Java applications. However, it does not contain the (Software Development Kits) SDKs needed to develop Android applications. The Android SDK is a collection of Java libraries that allow you to develop Android applications.
HANDS-ON ACTIVITY – Installing the Android SDK Manager
-
Visit http://developer.android.com/sdk/index.html. Note that this page contains options to install the Android Studio development platform, or just the SDKs designed for use with Eclipse, or other applications.
-
Scroll down until you see the following section. I downloaded and executed the Windows installer. (Installer_r24.4.1-windows.exe). Again, these version numbers change frequently.
-
Note that the installer will check that the necessary version of the Java Development environment is installed. If Java is not, the installer will fail.
-
Note that the SDK is stored in the folder C:\Program Files (x86)\Android\android-sdk, by default. Again, I selected all of the default options. You will need this folder name in a moment.
I also suggest that you use this folder name for your installation. As you move from computer to computer, certain installation differences will cause problems with the workspaces (programs).
-
The SDK manager should start. If it does not, run the program using the Start menu and run SDK Manager.exe. If the program does not appear on the Start menu, navigate to the above android-SDK directory and run the program.
Adding SDK Versions
Android operates in such a way that every SDK version is unique. That is, every Android device run a unique version of the software. When you build an Android application, you tell the compiler which android versions you want to support. This configuration makes it easy to use the development environment to build different software versions. And there are plenty of them.
The following link describes selected Android build numbers: https://source.android.com/source/build-numbers.html
Code Name
|
Version
|
API Level
|
Marshmallow
|
6.0
|
API level 23
|
Lollipop
|
5.1
|
API level 22
|
Lollipop
|
5.0
|
API level 21
|
KitKat
|
4.4 – 4.4.4
|
API level 19
|
There are older versions but you will not need them.
HANDS-ON ACTIVITY – Installing the Android SDK Manager
-
The Android SDK Manager should be running as shown in the following figure. The left column shows the Android packages. The right column shows which packages are installed.
-
Select the check boxes associated with the installed packages, and click the Install xx package… at the bottom of the screen. Note that this process can take quite a while. Note also that the SDK Manager must be run as Administrator.
-
In the Tools section, you need to install versions 24 back to version 21. Make sure to install the latest Android SDK Platform-tools.
-
For each of the API versions, install the SDK documentation, the SDK Platform, and the ARM EABI system images at a minimum. I installed the Intel x86 Atom System images. These system images provide alternate emulators that may perform faster than the ARM EABI system image depending on the graphics card you have installed.
-
I installed all of the above packages for all version 5.0.1 and greater.
Don’t worry, if you want to install additional versions and images later, you can. In addition, run the SDK manager occasionally to get updates.
-
Close the SDK manager and close Eclipse one more time.
Adding the ADT Plugin Repository
In this step, you are telling Eclipse about the Android SDKs that you just installed.
HANDS-ON ACTIVITY – Adding the ADT Plugin to Eclipse
-
Start Eclipse. Be sure to run Eclipse as an Administrator.
-
Select the default value for the workspace, if necessary.
-
Click Help / Install New Software from the menu bar. The following dialog box will appear:
-
Click the Add button to display the following dialog box:
-
In the Location text box enter http://dl-ssl.google.com/android/eclipse/
-
Click OK to close the dialog box. The following software packages should be located. You will need to expand the Developer Tools page. Your list might vary slightly from the one shown in the following figure:
-
I have included all of the developer tools. However, you should only need the Android DDMS and the Android Development Tools.
-
Click Next to begin the installation.
-
Accept the licenses, if necessary. Accept the warnings about non-trusted software. The process takes a few minutes.
-
You must restart Eclipse for the changes to take effect.
Next, you need to configure Eclipse so that it recognizes the plug-ins that you just installed.
-
On the menu, click Window / Preferences.
-
Click and expand the Android folder.
-
The SDK Location might already appear. If it does not, click Browse, and select the folder C:\Program Files (x86)\Android\android-sdk. Again, I assume that you installed the Android SDK in the default folder.
-
Click the Apply button. Your screen should look something like the following. The installed products might differ. As you can see, I have installed both the Google and Android Open Source versions of the APIs. I have also installed all of the APIs from versions 5.0.1 to 6.0.
-
Click the OK button and then restart Eclipse one more time.
Installing and Configuring the Emulator
There are two ways to debug and test an Android application.
-
You can use an emulator. Note that the emulator is very slow and a bit picky. There are several different emulators. Some seem to work better than others. Performance varies on the hardware and GPU configuration.
-
You can enable debugging and use your phone to test those applications you are developing. If you have an Android phone or tablet, this is the best and fastest solution. The steps to enable a phone or tablet vary from one manufacturer to the next. They also vary based on the Android version. Thus, the topic of configuring a phone or other device for development is not discussed in this document. The following Stack Overflow link is helpful. http://stackoverflow.com/questions/2714400/how-to-debug-on-a-real-device-using-eclipse-adt
Here, you will see how to configure the emulator.
Android manages a set of virtual devices (emulators) that can be used to test applications. Each emulator is designed to run a specific Android version. Each configured emulator also mimics a specific Android device, which has a size and screen resolution.
HANDS-ON ACTIVITY – Configuring an Emulator
-
On the Eclipse menu, click Window, Android Virtual Device Manager. The following dialog box appears:
-
As shown, there are no virtual devices configured. You can create as many virtual devices as you need for testing. Click the Create button to display the following dialog box:
As you can see, there are several options to create the emulator. For now, I suggest that you use the options shown in the preceding figure. They are known to work fairly well. Significant values are described in the following list:
-
The AVD Name is the descriptive name by which the emulator is known. You can create and run several emulators.
-
The Device indicates the type of device being emulated. There are several Nexus and generic devices of different sizes and resolutions. They are trying to mimic the corresponding real-world devices.
-
The possible options for the Target vary based on the device being emulated and the SDKs installed on your computer. Note that there are both Android and Google versions. I’ll be using Android 5.1.1 – API Level 22 for most applications in this course.
-
The CPU/ABI varies based on the selected target and the ARMs installed on your computer. I’ll use the most generic ARM(armeabi-v7a). In some cases, the Intel emulators are faster because they use virtualization hardware and the graphics accelerator.
-
On Windows computers, set the RAM to 512 MB. Larger amounts of memory will not work in the Windows emulator.
-
Click OK to create the device. The process takes a minute. The AVD should be created as shown in the following figure:
-
In the above dialog box, select the AVD that you just created, and click the Start button. The following figure has multiple AVDS. You will likely see only 1.
-
The following dialog box appears:
-
Check the box titled Scale display to real size, and then click Launch. The dialog box closes and another dialog appears while the AVD starts.
-
The emulator will start as shown in the following figure. Note that while the Android message appears, the device has not been fully started. Again. Don’t be alarmed. The process can take a few minutes.
At this point, you should be able to create and debug both Java and Android applications.
Page of
Share with your friends: |