This chapter mainly discusses how to build an Android development environment.
1.1 prepare for computer development
View System Requirements
Web page, to confirm that your computer is powerful!
1.2 Windows
Create an Android Development Environment
1.2.1 download the required installation package
To develop Android, you must install the Java Development Kit JDK and the Android Development Environment (IDE, such as Eclipse ). Of course, there are Android SDK packages.
1.
JDK
Go to http://java.sun.com/javase/downloads/index.jsp, and select the latest JDK download. I chose JDK 6 Update 20.
2.
Eclipse
Go to http://www.eclipse.org/downloads/, and select the latest JDK download. I selected eclipse-jee-galileo-sr2-win32.zip.
3.
Android-sdk
Go to http://androidappdocs.appspot.com/sdk/index.html, and select the latest sdkdownload for the operating system. I chose android-sdk_r06.
4.
ADT
Entering http://androidappdocs.appspot.com/sdk/eclipse-adt.html
To download the latest ADT. I chose ADT 0.9.7.
1.2.2 Java JDK
Install
Before downloading and installing Eclipse, because Eclipse is written in Java as a program, it requires JRE (Java Runtime Environment) to run. Therefore, JRE must be installed first, otherwise, an error occurs when you open Eclipse. JRE allows running of Java-based applications, but does not allow developers to create Java-based programs. To develop applications using Java on Android, You need to download and install JDK (Java Development Kit ),JDK
Including JRE
.
After installing JDK, make sure that the bin directory of JDK (such as E:/Tech/Java/jre6/bin) is included in the PATH environment variable.
Enter java-version in cmd. If the following is displayed, the installation is successful:
Java version "1.6.0 _ 20"
Java (TM) SE Runtime Environment (build 1.6.0 _ 20-b02)
Java HotSpot (TM) Client VM (build 16.3-b01, mixed mode, sharing)
1.2.3 Android SDK
Install
Note:
: Install JDK before installing the android SDK. Otherwise, the SDK cannot be installed.
Unzip the sdk first.
You must decompress the SDK to our SDK installation directory. Because the SDK installer downloads the corresponding package from the Internet and installs it, the installation directory is the decompressed directory.
The package to be installed will be selected during installation. If you are not familiar with it, it is best to use the default value;
The installer downloads the corresponding package from the Internet and installs the package without our intervention. However, it took a long time. It took me about two hours;
Add the absolute PATH of the SDK tools directory to the system PATH;
Check whether the installation is successful:
1.2.4 Eclipse
Install
Android applications are developed in Java. Android itself is not a language, but an environment for running applications. Theoretically, you can use any release or integrated development environment (IDE) to start your own development, such as using Borland's Jbuilder for development or open-source NetBeans. However, Eclipse is a Java Development IDE recognized by the Open Mobile Alliance and Google. Therefore, we generally choose to install Eclipse for application development. The following are some additional reasons for choosing Eclipse:
Ø Eclipse is open-source and free, and is also an available Java Development IDE. These features comply with the purpose and requirements of the Open Mobile Alliance to truly develop the mobile development market. In addition, Eclipse is easy to use.
The Open Mobile Alliance has released an Android Plugin for Eclipse, allowing developers to create Android-definition projects and run and debug compiled programs on the Android simulator. Android plugin has the tools and capabilities to shorten development time.
Ø Eclipse can also be used in Apple and Linux systems. Different systems have corresponding versions, and there are not many operational differences between them.
The software does not need to be installed. You only need to unmount the downloaded eclipseinstallation package directly to the installation environment. Click eclipse.exe and set the workspace.
1.2.5 Eclipse
Install Android Components
Android customizes a plug-in for Eclipse, namely, Android Development Tools (ADT), to provide users with a powerful integrated environment for developing Android applications. The ADT extends the Eclipse function, allowing you to quickly create Android projects, create application interfaces, add components based on the Android framework API, and debug applications using SDK toolsets, you can even export signed (or unsigned) APKs to release applications.
Installing the ADT Plugin
: ADT installation, configuration, update and uninstallation guide.
1.2.5.1 install components
The following describes how to install ADT:
Start Eclipse and select "Help-> Install New Software". The following figure is displayed:
Ø click "Available Software Sites" and fill in the following information in:
Name: Android Plugin
Location: https://dl-ssl.google.com/android/eclipse/
Note: If you have any problem with the subsequent plug-ins, change https in the above URL to http.
Select OK and return to the front graph. In the Work with list, select "Android Plugin ". Wait a moment, and "Developer Tools" appears in the list ". Select the following two plug-ins "Android DDMS" and "Android Development ". Click Next;
Ø the features of the two tool plug-ins will be listed in the future, and their Licence will be accepted. Finally, install and restart Eclipse;
1.2.5.2 configure Components
Configuring the ADT component is to specify the SDK directory for Eclipse.
Ø select the menu item Window> Preferences to open the Preferences panel;
Select "Android" on the left side of the panel, enter the SDK directory on the right side, and select Apply;
Ø OK. The Target found in the above SDK directory will be listed in the right list later.
1.2.6 added Android platform and other components
In the previous sections of Android SDK installation, selecting a package is the focus of this section.
After installing the SDK, you can start "android SDK and AVD manager" by starting SDK setup.exe under the SDK root directory ". Lists installed packages:
To download other components, go to the following page, which lists the components that are available and not installed on the Internet:
The android SDK uses a component structure to divide each component into multiple "components" that can be installed independently ". These components include Android platform versions, add-ons, tools, samples, and the API documentation.
Generally, the SDK we just downloaded contains only one component: the latest SDK tool. To develop Android programs, we need to add at least one Android platform to our development environment. Of course, Google recommends downloading other optional components.
1.2.6.1 what types of SDK components are available?
The SDK provides the following types of components:
Ø SDK tools
This component is pre-installed with the downloaded "android SDK starter package", which contains all the SDK tools required for development, debugging, and testing of our programs and UIS. For more information about SDK tools, see Dev guide.
: Http://androidappdocs.appspot.com/guide/developing/tools/index.html;
Ø Android platforms
An SDK platform is available for every production Android platform deployable to Android-powered devices. each platform component implements des a fully compliant Android library and system image, sample code, emulator skins, and any version specific tools. for detailed information about each platform, see the overview documents available under the section "Downloadable SDK Components," at left.
Ø SDK Add-Ons
SDK add-ons provide a development environment for specific Android external library or a customized (but fully compliant) Android system image. the Android SDK repository offers the Google APIs Add-On, which gives your application access to powerful mapping capabilities through the com. google. android. maps library. you can also add additional repositories, so that you can download other SDK add-ons, where available.
USB Driver for Windows
Contains driver files that you can install on your Windows computer, so that you can run and debug your applications on an actual device. you do not need the USB driver unless you plan to debug your application on an actual Android-powered device. if you develop on Mac OS X or Linux, you do not need a special driver to debug your application on an Android-powered device.
Ø Samples
Contains the sample code and apps available for each Android development platform. If you are just getting started with Android development, make sure to download the samples to your SDK.
Ø Documentation
Contains a local copy of the latest multiversion documentation for the Android framework API.
1.2.6.2 what components do we need?
According to our development needs, there are several development environments. The following table lists the components required:
Environment |
SDK Component |
Comments |
Basic |
SDK Tools |
If you 've installed the SDK starter package, then you already have this component preinstalled. The SDK Tools component is required-you can't develop or build an application without it. |
SDK platform |
You need to download at least one platform into your environment, so that you will be able to compile your application and set up an Android Virtual Device (AVD) to run it on (in the emulator ). to start with, just download the latest version of the platform. later, if you plan to publish your application, you will want to download other platforms as well, so that you can test your application on the full range of Android platform versions that your MERs are using. |
Recommended |
Documentation |
The Documentation component is useful because it lets you work offline and also look up API reference information from inside Eclipse. |
Samples |
The Samples components give you source code that you can use to learn about Android, load as a project and run, or reuse in your own app. note that multiple samples components are available-one for each Android platform version. when you are choosing a samples component to download, select the one whose API Level matches the API Level of the Android platform that you plan to use. |
Usb Driver |
The Usb Driver component is needed only if you are developing on Windows and have an Android-powered device on which you want to install your application for debugging and testing. for Mac OS X and Linux platforms, no special driver is needed. |
Full |
Google APIs |
The Google APIs add-on gives your application access to the Maps external library, which makes it easy to display and manipulate Maps data in your application. |
Additional SDK Platforms |
If you plan to publish your application, you will want to download additional platforms corresponding to the Android platform versions on which you want the application to run. the recommended approach is to compile your application against the lowest version you want to support, but test it against higher versions that you intend the application to run on. you can test your applications on different platforms by running in an Android Virtual Device (AVD) on the Android emulator. |
1.2.6.3 how to add Android Components
For this part of recommendations, see: http://androidappdocs.appspot.com/sdk/adding-components.html
.
Now, the Android development environment in Windows has been installed. In the future, we will use a project in the "Hello World" section to verify the feasibility of the environment.