一、 背景和準備
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 使用。請各位自行下載安裝。
?
四、 Eclipse 集成開發環境(IDE)搭建
現在開始Eclipse IDE及Android Eclipse plugin的安裝和配置,這里使用的Eclipse版本為,eclipse-java-helios-SR1-win32.zip,請自行到Eclipse官方網站(http://eclipse.org)上下載自己喜歡的版本,建議3.4以上版本。
我們使用的Android Eclipse Plugin 是ADT :Android Development Tools 。同Android SDK 一樣,分為在線安裝和手動安裝兩種方式。
在線安裝步驟如下:
??? 打開Eclipse,選擇菜單:Help->Install New Software...
??? 彈出“Available Software”對話框,點擊“Add...”按鈕
??? 彈出“Add Repository”對話框。
Name中輸入:ADT
Location中輸入:https://dl-ssl.google.com/android/eclipse/,如果不支持 https 可有輸入http://dl-ssl.google.com/android/eclipse/
如下圖:
點擊“OK”按鈕。
??? 此時Eclipse會搜索指定URL的資源,如果搜索無誤,會出現:Developer Tools的復選框,選中此復選框。點擊“Next”按鈕。
??? 出現“Install Details”對話框。點擊“Next”按鈕。
??? 出現“Review Licenses”對話框,選擇“I accept the terms of the license agreements”復選框。點擊“Finish”按鈕。
??? 進入下載及安裝過程:
??? 過程中可能會出現“Security Warning”對話框,不用擔心點擊“OK”按鈕以繼續安裝。
??? 安裝成功后,安裝提示重啟Eclipse,即完成整個安裝過程。
離線安裝步驟如下;
1. 訪問http://androidappdocs.appspot.com/sdk/eclipse-adt.html獲取當前最新版本的ADT Eclipse離線安裝包,當前最新版本為:ADT 9.0.0,下載地址為:http://dl.google.com/android/ADT_9.0.0.zip
2. 開始Eclipse Plugin的本地安裝過程中,如下。由于整個過程跟在線安裝類似,具體不再詳述。
?
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
