最近要学习Android,首先第一件事就是搭建 Android 的开发环境,几经周折终于搞定,其中参考了很多好的博文和其他资料,写下来为了感谢博友,也为了分享经验,共同进步。

具体步骤如下(接上篇日志):

5. 安装 Eclipse Android ADT 插件


1) 可以直接到 Android 官网去下载这个 ADT 插件。
笔者是到 http://androidappdocs.appspot.com/sdk/eclipse-adt.html#installing 这里下载了 ADT-0.9.9.zip

此处参考英文,其实都是很简单的英文,不浪费时间

1. Start Eclipse, then select Help > Install New Software .

2. In the Available Software dialog, click Add... .

3. In the Add Site dialog that appears, enter a name for the remote site (for example, "Android Plugin") in the "Name" field.

In the "Location" field, enter this URL:

https : //dl-ssl.google.com/android/eclipse/

Note: If you have trouble acquiring the plugin, you can try using "http" in the URL, instead of "https" (https is preferred for security reasons).

Click OK .

4. Back in the Available Software view, you should now see "Developer Tools" added to the list. Select the checkbox next to Developer Tools, which will automatically select the nested tools Android DDMS and Android Development Tools. Click Next .

5. In the resulting Install Details dialog, the Android DDMS and Android Development Tools features are listed. Click Next to read and accept the license agreement and install any dependencies, then click Finish .

6. 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 .

Done! If you haven't encountered any problems, then the installation is complete. Now read Adding Platforms and Other Components for instructions on how to complete the setup of your SDK environment.

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 3.3/3.4, 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 0.9.9

ADT-0.9.9.zip

8301681 bytes

7deff0c9b25940a74cea7a0815a3bc36

2. Follow steps 1 and 2 in the default install instructions (above).

3. In the Add Site dialog, click Archive .

4. Browse and select the downloaded zip file.

5. In Eclipse 3.5 only, enter a name for the local update site (e.g., "Android Plugin") in the "Name" field.

6. Click OK .

7. Follow the remaining procedures as listed for default installation above, starting from step 4.

To update your plugin once you've installed using the zip file, you will have to follow these steps again instead of the default update instructions.

Other install errors

Note that there are features of ADT that require some optional Eclipse components (for example, WST). If you encounter an error when installing ADT, your Eclipse installion might not include these components. For information about how to quickly add the necessary components to your Eclipse installation, see the troubleshooting topic ADT Installation Error: "requires plug-in org.eclipse.wst.sse.ui" .

6. 配置 Eclipse Android ADT 插件

1) 设置 Eclipse Java JDK 属性设置
选择【 Window > Preferences… 】打开编辑属性窗口;选择 Java 属性面板;选择 Java 编译器为 6.0 ;点击 Apply ,和 OK

2) 进行 Android SDK 设置
选择【 Windows > Preferences… 】打开编辑属性窗口;选择 Android 属性面板;加入 Android SDK 的目录(点击【 Browse… 】进行选择,这里是 "D:/android-sdk-windows/" 目录)。

7. 测试开发环境

搭建好开发环境之后,我们来创建一个 Hello World 工程,体验一下 Android 的开发。
1) 选择【 File > New > Project
2) 选择【 Android > Android Project 】,点击【 Next

3) 对新工程进行设置,点击 Finish

Windows XP下Android开发环境搭建(二)_第1张图片

4) 将文件 HelloAndroid.java 中的代码修改为 :

package com.example.hello;




public class HelloAndroid extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super .onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");

setContentView(tv);
}
}

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

运行程序,第一次启动 AVD ,时间有点长,运行效果为 :

Windows XP下Android开发环境搭建(二)_第2张图片

参考博客及其他资料:

http://blog.csdn.net/Mac_cm/archive/2009/01/06/3720492.aspx

(如何在Windows下搭建Android开发环境)

http://blog.163.com/liu_yang1234/blog/static/24474310201081734627645/

(详解)Eclipse3.6搭建Android 2.2开发环境

http://ethan163.javaeye.com/blog/792209

http://androidappdocs.appspot.com/sdk/installing.html

更多相关文章

  1. Android线性LinearLayout布局xml属性介绍
  2. android 自学初级第一天 环境搭建与hello word
  3. Ubuntu下安装android开发环境经历
  4. Android 自定义属性时TypedArray的使用方法
  5. android开发1:安卓开发环境搭建(eclipse+jdk+sdk)
  6. Android属性动画应用超简单代码打造酷炫扇形(卫星),圆形菜单

随机推荐

  1. android RecyclerView 中添加 FooterView
  2. adb通过wifi连接 milestone
  3. 我的第一个Android程序,BMI计算器,分享一下
  4. android:The application has stopped une
  5. Android之FastJSon基本使用,属性首字母大
  6. [转]android adapter 深刻分析
  7. Android(安卓)开发错误集锦
  8. 使用Canvas的drawTextOnPath方法实现沿着
  9. Android(安卓)Studio第一次安装遇见的问
  10. Android(安卓)SurfaceFlinger 学习之路(