0,簡介:
最近簡單着手了解 android 開發.工欲善其事,必先利其器. 我本人不太喜歡使用java 開發,所以簡單了解了下其 c# c++都可以進行android 開發,用c++的話要使用NDK.在跨平台方面 QT在效率方面要比java 強很多.但從入手的難易程度來看,要屬java最易上手了.
下面介紹adt-bundle-windows-x86的安裝方法 ,可以這里下載 http://developer.android.com/sdk/index.html
來自官網的介紹:
The Android SDK provides you the API libraries and developer tools necessary to build, test, and debug apps for Android.
If you're a new Android developer, we recommend you download the ADT Bundle to quickly start developing apps. It includes the essential Android SDK components and a version of the Eclipse IDE with built-in ADT (Android Developer Tools) to streamline your Android app development.
With a single download, the ADT Bundle includes everything you need to begin developing apps:
- Eclipse + ADT plugin
- Android SDK Tools
- Android Platform-tools
- The latest Android platform
- The latest Android system image for the emulator
所以對於剛入手的來說,還是可以節約不少搭建平台的麻煩的.
下載軟件包之后 ,解壓到你的本地程序目錄.里面包括
到打開eclipse 文件夾,雙擊 eclipse.exe 便可以 運行了.如果提示未安裝虛擬機,可以網上查找,並配置好虛擬機的環境變量,完成之后需要重新注銷系統 .
1,adt-bundle-windows-x86 sdk更新:
打開Android SDK Managner ,這里按需要自己添加.如果需要連接真機調試,需要添加
2,配置android模擬器:
在進行模擬器的配置時,遇到了點小麻煩. 這里了 "PANIC: Could not open:"錯誤.我對錯誤進行了簡單的分析,默認AVD 創建虛擬機的路徑是 "\My Documents\.android" 但是打開時的路徑確是 "C:\Documents and Settings\Administrator\.android" 如果遇到同樣的問題,可以采用下面的方法進行解決:
Create a environment variable called: ANDROID_SDK_HOME and set it to C:\Users\Administrator Open Eclipse > Window > Preferences and click in Run/Debug and String Substitution Add a new variable called: user.home and set it to C:\Users\Administrator Create an AVD and run it.
這里 "Users"換成 "Documents and Settings" .
這里給出了解釋 :
As a work-around, you can define the environment variable ANDROID_SDK_HOME to point to the directory containing your .android directory. The emulator and SDK Manager will pick it up properly.
環境變量設置需要重新注銷.
3,配置環境變量
環境變量的設置也較為簡單, 與設置java虛擬機的方法類似.這里把 D:\Program File\adt-bundle-windows-x86-20131030\adt-bundle-windows-x86-20131030\sdk 下platform-tools 和 tools 文件夾添加到環境變量 .
4,hello world
創建第一個工程,File->new->Android Aplication Project 過程比較簡單不再贅述.目錄結構如下:
5,模擬器調試
右擊android工程->Run as->Android Application 選擇模擬器.
模擬器運行比較緩慢,本人覺得使用起來很不方便.界面如圖:
6,真機調試
手機首先需要打開 開發者模式,並且允許debug ,並且安裝好google usb driver .連接手機 ,在eclpse 中開打 windows->open perspective->DDMS 可以看到連接的手機.強調一點,先連接手機再打開eclipse ,反過來操作會出現offline狀態.
如果顯示 offline 可以手動結束adb.exe 重新連接設備.
補充:對於如果出現上面模擬器相關問題,只需要設置ANDROID_SDK_HOME 變量及可. 這個ADT Bundle 甚至不用設置 環境變量,應該是先進行相對路徑查找,如果查找不到再環境變量中查找.
參考:
http://stackoverflow.com/questions/15103782/avd-panic-could-not-open-not-a-path-issue
相似內容:
http://blog.csdn.net/wangqiuyun/article/details/8731240