最近要学习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

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 ,时间有点长,运行效果为 :

参考博客及其他资料:

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(安卓)Wear手表蓝牙连接Android(安卓)Studio调试/开发的
  3. android动画效果
  4. 在Android(安卓)开发中使用Protobuf的实践和经验分享
  5. Android音频开发(3):如何播放一帧音频
  6. Android(安卓)HAL 开发 (1)
  7. Android(安卓)IOS WebRTC 音视频开发总结(八)-- iosWebRTCDemo
  8. Androidstudio开发button按钮的操作以及项目开发大致过程
  9. Android(安卓)游戏开发基础

随机推荐

  1. Android(安卓)的核心服务
  2. 工作总结|Android(安卓)自定义列表刷新控
  3. android 网络访问-图片处理优秀开源项目
  4. android九宫格实现
  5. Android横屏竖屏切换的问题
  6. Android学习入门
  7. 淘宝Android客户端技术分析
  8. android中Intent简介
  9. 程序设置横屏后,锁屏时会被销毁一遍,解锁时
  10. 自定义tabhost实现