In order to prepare a development environment for Android, you need four components:
- Java SE Development Kit (JDK for short).
- Eclipse Integrated Development Environment – Eclipse IDE.
- Development kit for the Android platform – Android Software Developer’s Kit (abbreviated as Android SDK or simply SDK).
- The Android Developer Tools (ADT for short) is a dedicated plug-in for Eclipse.
It should be noted that in order to avoid problems with Proguard on Windows (errors like “Expecting class path separator ‘;’ before ‘Files \ Java \ …”), it is better to install Eclipse and Android SDK in a directory with no paths space character, for example:
C: \ droid \ eclipse \ C: \ droid \ android-sdk \
When working with Eclipse, it is also better to specify paths to workspace and projects without spaces, for example:
C: \ droid \ workspace
Installing the Java SE Development Kit
You can download the JDK from the Oracle website . At the time of this writing, the latest version is JDK 7u2. However, we recommend that you install JDK 1.6, otherwise you may experience problems with ProGuard.
On Mac OS X, as well as many Linux distributions, the JDK is already preinstalled.
Installing the Eclipse IDE
The Android SDK requires Eclipse 3.3 or later. You can download it from the developer’s website . You need a version of the Eclipse IDE labeled “Eclipse IDE for Java Developers” for a specific operating system.
On Windows, Eclipse is downloaded as a ZIP file, which should be extracted to a directory of your choice, for example, C: \ droid \ eclipse \. Please note that after installation, Eclipse does not appear in the application menu, but nothing prevents you from creating an appropriate shortcut for C: \ droid \ eclipse \ eclipse.exe and placing it in a convenient place.
For Linux and Mac OS X, Eclipse is supplied as a GZ file that must be extracted to a directory of your choice, for example \ usr \ lib \ eclipse \. The key executable is also called eclipse here.
Please note that when starting Eclipse on Windows, it may display an error with the following content – “Failed to create the Java Virtual Machine”. This problem can be solved by specifying the direct path to the virtual machine in the “eclipse.ini” configuration file. To do this, at the beginning, you must enter the following two lines:
-vm C: / Program Files / Java / jdk1.X / bin / javaw.exe
Here, instead of JDK1.X, you must specify the correct name of the JDK directory on your system.
For practicing programmers, the Eclipse development environment may already be installed. Android development requires plugins such as Java Development Tool (JDT) and Web Standard Tools (WST).
You can check this in the “Windows”> “Preferences” menu. The preference list should include one entry for “Java” and one for “XML” or for “Web and XML”. If these items are not listed, the easiest way is to reinstall Eclipse according to the above recommendations.
Installing Android Software Developer’s Kit
The Android SDK is available on the official Android website .
The delivery file is also an archive. In general, the steps are similar to the actions from the previous paragraph, therefore, they do not need additional explanations. Just to remind you that the presence of spaces in the Android SDK installation path is undesirable, although the automatic installer for Windows, which can also be downloaded from the above link, offers by default the installation option in the “Program Files” directory.
Updating environment variables
Extracting files from the Android SDK archive will create a directory tree that contains several subdirectories, including a subdirectory named “tools”. To make it easier to run Android tools, add this folder to your PATH search path variable.
On Windows, this is done in System Properties> Advanced system settings> Environment Variables.
In Linux, add or completely write the line in the file ~ \ bashrc or ~ \ .bash_profile
export PATH = $ {PATH}: sdk-dir \ tools
where sdk-dir is the path to the Android SDK installation directory.
In Mac OS X, add or completely write the line in the “.bash_profile” file in the “home” directory
export PATH = $ {PATH}: sdk-dir \ tools
where sdk-dir is the path to the Android SDK installation directory.
Installing Android Developer Tools
This plug-in is installed in the same way as any other Eclipse plug-in.
- Launch Eclipse.
- Open the “Help”> “Install New Software” menu.
- In the “Install” window that appears, in the “Work with” field, enter the resource address – https://dl-ssl.google.com/android/eclipse and press Enter. After that, Eclipse will connect to the resource and load a list from there, which will be displayed as “Developer Tools” with several subordinate nodes a few fields to the right, iterated over by Tab.
- Check the box for the Developer Tools node, and it is also advisable to make sure that all subordinate nodes are also checked. Then press the “Next” button.
- In the next step, a window will appear to accept the license agreement and complete the installation. There are no nuances here, just select the “I accept” radio button and click on the “Next” and “Finish” buttons several times.
- After that, Eclipse will automatically download and install ADT, and then prompt itself to restart, which must be done to start using the plug-in.
It should be noted that an error like “Unable to read repository at …” may appear at the third step. To solve this problem, you can try to disable the used firewall or change the HTTPS protocol to HTTP.
You can update previously installed versions of ADT through the “Help”> “Check for Updates” menu, where the steps are generally similar to the installation process.
Synchronizing Eclipse with Android SDK
After restarting Eclipse, it should be told where the Android SDK is located. To do this, open the Window> Preferences menu. In the opened “Preferences” dialog box, select “Android” in the tree and, reaching the “Browse” button, start the directory selection dialog, where and specify the Android SDK installation path, for example, C: \ droid \ android-sdk \.
Eclipse will then display the message “SDK Platform Tools component is missing! Please use the SDK Manager to install it”.
The point is that the Android SDK archive initially contains only basic tools without the main platform and third party libraries. In principle, it does not even include all the key components required for application development.
Loading Android SDK components
To start developing, you need to install the tooling platform and at least an API for at least one version of Android OS. To load these components, there is a special SDK Manager utility, which can be found in the root directory where the Android SDK is installed, for example:
C: \ droid \ android-sdk \ SDK Manager.exe
After starting the SDK Manager, a menu will open, in which you need to check the components of interest and click on the “Install * packages …” button, where instead of “*” (asterisks) there will be the total number of selected packages. In the next dialog, you can once again view the list of selected components and read their general description, and by clicking on the “Install” button, proceed to download them from the server.
It should be noted that accessibility functionality appeared in Android starting only with version 1.6, and branch number 3 is parallel to branch number 2 and is designed to work exclusively with tablet computers. In addition, modern screen readers require at least Android 2.2 to fully utilize all their functions.
However, the Android platform is characterized by a low level of compatibility of its versions, both forward and backward, so if you intend to develop applications aimed at a wide range of devices, and not only taking into account the specifics of users with visual impairments, then it makes sense to install the API of all versions.
All components are installed in the same directory where the Android SDK was previously unpacked, and downloading them from the Internet can take quite a long time.
After completing this process, the development environment for the Android operating system will be completely ready for work.