Step 1. Preparing Your Development Computer
1. Install JDK
http://www.oracle.com/technetwork/java/javase/downloads/index.html
2. Install Eclipse (Eclipse for Java Developers or Eclipse Classic is recommended)
http://www.eclipse.org/downloads/
Step 2. Downloading the SDK Starter Package
Platform | Package | Size | MD5 Checksum |
---|---|---|---|
Windows | android-sdk_r12-windows.zip | 36486190 bytes | 8d6c104a34cd2577c5506c55d981aebf |
installer_r12-windows.exe (Recommended) | 36531492 bytes | 367f0ed4ecd70aefc290d1f7dcb578ab | |
Mac OS X (intel) | android-sdk_r12-mac_x86.zip | 30231118 bytes | 341544e4572b4b1afab123ab817086e7 |
Linux (i386) | android-sdk_r12-linux_x86.tgz | 30034243 bytes | f8485275a8dee3d1929936ed538ee99a |
If above link doesn’t work, refer to http://developer.android.com/sdk/installing.html (need to over the GFW)
If you downloaded a .zip or .tgz package (instead of the SDK installer), unpack it to a safe location on
your machine. By default, the SDK files are unpacked into a directory named android-sdk-<machineplatform>.
If you downloaded the Windows installer (.exe file), run it now and it will check whether the proper Java
SE Development Kit (JDK) is installed (installing it, if necessary), then install the SDK Tools into a default
location (which you can modify).
Make a note of the name and location of the SDK directory on your system—you will need to refer to the
SDK directory later, when setting up the ADT plugin and when using the SDK tools from command line.
Step 3. Installing the ADT Plugin for Eclipse
Downloading the ADT Plugin
1. Start Eclipse, then select Help > Install New Software....
2. Click Add, in the top-right corner.
3. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for
the Location:
https://dl-ssl.google.com/android/eclipse/
Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https
is preferred for security reasons).
Click OK.
4. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
5. In the next window, you'll see a list of the tools to be downloaded. Click Next.
6. Read and accept the license agreements, then click Finish.
7. When the installation completes, restart Eclipse.
Configuring the ADT Plugin
Once you've successfully downloaded ADT as described above, the next step is to modify your ADT
preferences in Eclipse to point to the Android SDK directory:
1. Select Window > Preferences... to open the Preferences panel (Mac OS X: Eclipse > Preferences).
2. Select Android from the left panel.
3. For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.
4. Click Apply, then OK.
Troubleshooting ADT Installation
If you are having trouble downloading the ADT plugin after following the steps above, here are some
suggestions:
· If Eclipse can not find the remote update site containing the ADT plugin, try changing the remote site URL
to use http, rather than https. That is, set the Location for the remote site to:
http://dl-ssl.google.com/android/eclipse/
· If you are behind a firewall (such as a corporate firewall), make sure that you have properly configured
your proxy settings in Eclipse. In Eclipse, you can configure proxy information from the main Eclipse
menu in Window (on Mac OS X, Eclipse) > Preferences > General > Network Connections.
If you are still unable to use Eclipse to download the ADT plugin as a remote update site, you can
download the ADT zip file to your local machine and manually install it:
1. Download the current ADT Plugin zip file from the table below (do not unpack it).
Name Package Size MD5 Checksum
ADT 10.0.1 ADT-10.0.1.zip 5096182 bytes e26a77db08377bdd2e62edeb9a3e3701
2. Follow steps 1 and 2 above
3. In the Add Site dialog, click Archive.
4. Browse and select the downloaded zip file.
5. Enter a name for the local update site (e.g., "Android Plugin") in the "Name" field.
6. Click OK.
Step 4. Adding Platforms and Other Components
You can launch the Android SDK and AVD Manager in one of the following ways:
· From within Eclipse, select Window > Android SDK and AVD Manager.
· On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
· On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute:
android
To download components, use the graphical UI of the Android SDK and AVD Manager, shown in below
figure, to browse the SDK repository and select new or updated components. The Android SDK and AVD
Manager will install the selected components in your SDK environment.
Please install below components:
Android SDK tools
Android SDK Platform-tools
SDK platform Android 2.3, API 9 (the latest one)
Documentation for Android SDK, API 9
Samples for Android SDK, API 9
Step 5. Create an AVD
1. In Eclipse, choose Window > Android SDK and AVD Manager.
2. Select Virtual Devices in the left panel.
3. Click New.
The Create New AVD dialog appears.
4. Type the name of the AVD, such as "my_avd".
5. Choose a target. The target is the platform (that is, the version of the Android SDK, such as 2.3) you want
to run on the emulator.
You can ignore the rest of the fields for now.
6. Click Create AVD.
7. Select the AVD you just created, and click Start… > Launch
8. Enjoy playing the emulator, which is an android phone on your computer
Useful Android WebSite:
http://developer.android.com/index.html
来源:https://www.cnblogs.com/jalenwang/archive/2011/08/17/android_env_setup.html