前置条件:
a)JDK 1.5+已安装好并配置好JAVA_HOME路径;
b)下载eclipse 3.5.2 for Java Developer
1、Android SDK的安装
官方下载页面:http://androidappdocs.appspot.com/sdk/index.html
最新版【AndroidSDK安装器】下载地址:http://dl.google.com/android/android-sdk_r07-windows.zip
将android-sdk_r07-windows.zip解压至硬盘,如E盘,得到【E:\android-sdk-windows】文件夹
安装方式:
a)网络自动安装(速度非常慢):
运行SDK Manager.exe,选择需要的版本开始安装;
b)手工安装(速度很快,可用迅雷下载):
通过分析http://dl-ssl.google.com/android/repository/repository.xml这个文件得到下载地址:
下载各版本Android及相关文档:
http://dl-ssl.google.com/android/repository/android-1.5_r04-windows.zip
http://dl-ssl.google.com/android/repository/android-1.6_r03-windows.zip
http://dl-ssl.google.com/android/repository/android-2.0.1_r01-windows.zip
http://dl-ssl.google.com/android/repository/android-2.0_r01-windows.zip
http://dl-ssl.google.com/android/repository/android-2.1_r02-windows.zip
http://dl-ssl.google.com/android/repository/android-2.2_r01-windows.zip
http://dl-ssl.google.com/android/repository/docs-2.2_r01-linux.zip
http://dl-ssl.google.com/android/repository/google_apis-3-r03.zip
http://dl-ssl.google.com/android/repository/google_apis-4_r02.zip
http://dl-ssl.google.com/android/repository/google_apis-5_r01.zip
http://dl-ssl.google.com/android/repository/google_apis-6_r01.zip
http://dl-ssl.google.com/android/repository/google_apis-7_r01.zip
http://dl-ssl.google.com/android/repository/google_apis-8_r02.zip
http://dl-ssl.google.com/android/repository/jboss-5.1.0.GA.zip
http://dl-ssl.google.com/android/repository/samples-2.1_r01-linux.zip
http://dl-ssl.google.com/android/repository/samples-2.2_r01-linux.zip
http://dl-ssl.google.com/android/repository/tools_r06-windows.zip
http://dl-ssl.google.com/android/repository/usb_driver_r03-windows.zip
按下面关系表解压文档,重命名后放入sdk的相应文件夹中:
android-1.5_r04-windows.zip==>platforms\android-3 android-1.6_r03-windows.zip==>platforms\android-4 android-2.0_r01-windows.zipp==>platforms\android-5 android-2.0.1_r01-windows.zip==>platforms\android-6 android-2.1_r02-windows.zip==>platforms\android-7 android-2.2_r01-windows.zip==>platforms\android-8 google_apis-3-r03.zip==>add-ons\addon_google_apis_google_inc_3 google_apis-4_r02.zip==>add-ons\addon_google_apis_google_inc_4 google_apis-5_r01.zip==>add-ons\addon_google_apis_google_inc_5 google_apis-6_r01.zip==>add-ons\addon_google_apis_google_inc_6 google_apis-7_r01.zip==>add-ons\addon_google_apis_google_inc_7 google_apis-8_r01.zip==>add-ons\addon_google_apis_google_inc_8 docs-2.2_r01-linux.zip==>docs samples-2.1_r01-linux.zip==>samples\android-7 samples-2.2_r01-linux.zip==>samples\android-8 tools_r06-windows.zip==>tools usb_driver_r03-windows.zip==>usb_driver
如果只想安装2.2版的,下载这几个文件就可以了:
SDK:http://dl-ssl.google.com/android/repository/android-2.2_r01-windows.zip
DOC:http://dl-ssl.google.com/android/repository/docs-2.2_r01-linux.zip
API:http://dl-ssl.google.com/android/repository/google_apis-8_r02.zip
实例:http://dl-ssl.google.com/android/repository/samples-2.2_r01-linux.zip
源代码:http://devfrustrated.com/devBlog/wp-content/uploads/2010/07/sources_2.2.zip
工具:
http://dl-ssl.google.com/android/repository/tools_r06-windows.zip
http://dl-ssl.google.com/android/repository/usb_driver_r03-windows.zip
2、ADT的安装和配置
同样有两种安装方式,推荐手动安装:
下载地址:
0.9.7版:http://dl.google.com/android/ADT-0.9.7.zip
0.9.9版:http://dl.google.com/android/ADT-0.9.9.zip
离线安装:【help】-》【Install New Software...】,在弹出界面中选择【Add】按钮;
Name输入: ADT
Location:点击 Archive 按钮,选择ADT-0.9.9.zip
3、Android模拟器的配置
运行eclipse,设置Android SDK位置:
【Window】-》【Preferences】-》【Android】-》【SDK Location】
配置模拟器AVD(Android Virtual Device)
【Window】-》【Android SDK and AVD Manager】
在【Virtual Devices】中选择【New...】按钮:
在弹出的【Create new Android Virtual Device(AVD)的页面进行设置:
Name:2.1(最好与版本对应,这里的名称可以自定义,也就是说通过设置不同名称,相同Level,可以创建并运行多个相同版本的模拟器)
Target:Android 2.1 - API Level 7
SD Card: Size 256M
然后点击【Create AVD】即可创建2.1版的AVD,其他版本类似。
最后配置Tools的路径,该路径下包含很多工具( 注意路径前面要加分号 ):
参考文档: