职业IT人-IT人生活圈

 找回密码
 成为会员
搜索
查看: 681|回复: 9

Android SDK 2.3与Eclipse最新版开发环境搭建(一)

[复制链接]
只学java 发表于 2011-6-18 21:15 | 显示全部楼层 |阅读模式
一、 背景和准备

1. Android 简介

Android是Google于2007年11月5日宣布的基于Linux平台的开源手机操作系统的名称,该平台由操作系统、中间件、用户界面和应用软件组成,号称是首个为移动终端打造的真正开放和完整的移动软件。可以把它简单理解成Linux上套了一个JAVA的壳。

Android 的平台基本上是免费的,虽然有部份原生链接库会要求费用,但大部份是免权利金。Android 的程序可以采用JAVA开发,因为它的虚拟机(Virtual Machine) Dalvik,只是它将JAVA的bytecode 转成自己的格式,回避掉需要付给SUN 有关JAVA 的授权费用。因此,Android 开发环境是需要JDK的。

2. Android 网络资源

Android的网站是:http://www.android.com/ ,目前还可以登陆,比较悲剧的是:其Partners部分:http://source.android.com/ 和Developers部分:http://developer.android.com/ ,大陆地区已经无法访问。

Android的系统要求请参考:http://androidappdocs.appspot.com/sdk/requirements.html

当前最新版本的Android SDK下载器(真正的SDK还是需要另外下载的),小生是无法直接到官网http://developer.android.com/sdk/index.html 下载的,于是另外找了一个地址http://androidappdocs.appspot.com/sdk/index.html ,下载链接和说明如下:

Android SDK for Windows
android-sdk_r08-windows.zip
http://dl.google.com/android/android-sdk_r08-windows.zip
installer_r08-windows.exe (Recommended)
http://dl.google.com/android/installer_r08-windows.exe
Android SDK for Mac OS X (intel)
android-sdk_r08-mac_86.zip
http://dl.google.com/android/android-sdk_r08-mac_86.zip
Android SDK for Linux (i386)
android-sdk_r08-linux_86.tgz
http://dl.google.com/android/android-sdk_r08-linux_86.tgz
Here's an overview of the steps you must follow to set up the Android SDK:
   1. Prepare your development computer and ensure it meets the system requirements.
   2. Install the SDK starter package from the table above. (If you're on Windows, download the installer for help with the initial setup.)
   3. Install the ADT Plugin for Eclipse (if you'll be developing in Eclipse).
   4. Add Android platforms and other components to your SDK.
   5. Explore the contents of the Android SDK (optional).

3. 软件包下载

a. JDK 1.6

下载网址: http://www.oracle.com/technetwork/java/javase/downloads/index.html

当前最新版本为Java SE 6 Update 23

小生机器上安装的是:jdk1.6.0_21,也一样用,其实只要你是JDK1.5以上就可以了。

b. Android SDK下载器

下载地址上面已经给出了,可以根据你的系统选择不同的安装包。小生是windows 2003 server,因此下载了http://dl.google.com/android/android-sdk_r08-windows.zip ,之后直接解压缩即可。

c. Eclipse IDE

Eclipse 3.4 (Ganymede)以后版本均可。小生下载了最新版本的Helios (3.6)

二、 JAVA 环境

Windows上配置JAVA环境变量如下:

JAVA_HOME




Path:





三、 Android SDK 安装

Android SDK 可以通过SDK 下载器自动下载和配置,适合网络好,下载速度快的情况下;也可以借助工具下载SDK 文件,手工配置,适合网络不是很好,下载速度慢的情况下。

SDK 下载器自动下载步骤如下:

    解压缩android-sdk_r08-windows下载器,并双击运行SDK Manager.exe:





如果你的电脑不支持https连接会看到如下界面:




请选择setting的将Force https://... Sources to be fetched by using http://... 的选项打勾





    勾选你想要安装的Packages,并点击Install Selected进行安装:








    确认对话框如下,选择Accept All进行下载安装






    则Android SDK下载器进入下载安装的过程


    根据你网速的情况,下载安装的时间或长或短,请耐心等待。

手动下载步骤如下:

    通过分析Android下载器的http://dl-ssl.google.com/android/repository/repository.xml 内容,可以得到如下下载列表(以Windows环境为例):

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_r01-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.1_r02-windows.zip

http://dl-ssl.google.com/android/repository/android-2.2_r02-windows.zip

http://dl-ssl.google.com/android/repository/android-2.3.1_r02-linux.zip

http://dl-ssl.google.com/android/repository/android-3.0_pre_r01-linux.zip

http://dl-ssl.google.com/android/repository/platform-tools_r02-windows.zip

http://dl-ssl.google.com/android/repository/tools_r09-windows.zip

http://dl-ssl.google.com/android/repository/docs-Honeycomb_pre_r01-linux.zip

http://dl-ssl.google.com/android/repository/samples-Honeycomb_pre_r01-linux.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/samples-2.3_r01-linux.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.zip 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_r02-windows.zip platforms\android-8
android-2.3.1_r02-linux.zip platforms\android-9
android-3.0_pre_r01-linux.zip platforms\android-10
platform-tools_r02-windows.zip platforms-tools
tools_r09-windows.zip tools
docs-Honeycomb_pre_r01-linux.zip doc
samples-Honeycomb_pre_r01-linux.zip samples\android-10
samples-2.1_r01-linux.zip samples\android-7
samples-2.2_r01-linux.zip samples\android-8
samples-2.3_r01-linux.zip samples\android-9

    如果要安装google api,请分析下图中的地址:http://dl-ssl.google.com/android/repository/addon.xml 下载自己需要的Packages进行解压,方法同1、2





下载列表为:

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/google_apis-9_r02.zip

http://dl-ssl.google.com/android/repository/market_licensing-r01.zip

http://dl-ssl.google.com/android/repository/usb_driver_r04-windows.zip

    映射关系为:

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_r02.zip add-ons\addon_google_apis_google_inc_8
google_apis-9_r02.zip add-ons\addon_google_apis_google_inc_9
market_licensing-r01.zip google-market_licensing
usb_driver_r04-windows.zip usb_driver

    具体的目录结构如下图:




    解压完成后启动一下SDK下载器,检查是否安装成功,如下图:





注:由于小生在写这篇文章的时候,Android 刚出了Android SDK Platform Honeycomb Preview, revision 1 ,但是却没有把android-3.0_pre_r01-linux.zip 放在http://dl-ssl.google.com/android/repository/android-3.0_pre_r01-linux.zip ,所以暂时无法下载安装这个版本的Android SDK ,但不影响SDK 使用。请各位自行下载安装。

大小: 15.5 KB

大小: 51.9 KB

大小: 41 KB

大小: 34 KB

大小: 73.7 KB

大小: 41.6 KB

大小: 28.7 KB

大小: 86.5 KB

大小: 55.7 KB

大小: 76.2 KB

大小: 44.1 KB
查看图片附件

broken 发表于 2011-6-18 21:15 | 显示全部楼层
不错,很详细

江南枫 发表于 2011-6-18 21:16 | 显示全部楼层
很适合我这种新手

秋秋 发表于 2011-6-18 21:16 | 显示全部楼层
楼上你头像,笑的跟爆米花一样。。。

钰云 发表于 2011-6-18 21:16 | 显示全部楼层

更更悲剧的是,这个地址也被墙了
http://androidappdocs.appspot.com/sdk/index.html

愚人 发表于 2011-6-18 21:16 | 显示全部楼层
谢·谢楼主,唉,麻烦啊~~~能有类似VS的工具就爽了~~~~

芷馨 发表于 2011-6-18 21:16 | 显示全部楼层
很详细的   环境搭建!



broken 发表于 2011-6-18 21:16 | 显示全部楼层
很好,学习!!

醉倚西风 发表于 2011-6-18 21:16 | 显示全部楼层
很好哦! 谢谢了!

走失的猫咪 发表于 2011-6-18 21:17 | 显示全部楼层
搞 定安装


您需要登录后才可以回帖 登录 | 成为会员

本版积分规则

QQ|手机版|小黑屋|网站帮助|职业IT人-IT人生活圈 ( 粤ICP备12053935号-1 )|网站地图
本站文章版权归原发布者及原出处所有。内容为作者个人观点,并不代表本站赞同其观点和对其真实性负责,本站只提供参考并不构成任何投资及应用建议。本站是信息平台,网站上部分文章为转载,并不用于任何商业目的,我们已经尽可能的对作者和来源进行了通告,但是能力有限或疏忽造成漏登,请及时联系我们,我们将根据著作权人的要求立即更正或者删除有关内容。

GMT+8, 2024-3-28 17:09 , Processed in 0.144804 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表