2010年9月24日 星期五

第一篇: Android 初心

安裝Android程式設計平台:
  1. Eclipse 
  2. ADT plugin
  3. Android SDK
有關SDK和ADT的安裝,在官網http://developer.android.com/,都有詳細的說明。


在Eclipse下,可以設計不同的平台,called "Perspective"。
Java programming在Eclipse之下有兩個適用的perspectives: (1) Java (2) debug。
執行方式也分為兩種,debug、run兩種。 然而針對不同的程式語言,需要對debug、run做不同的設定。

在Android的平台下,執行必須要藉由一個模擬器,called "Android Virtual Device"。這個平台是設定好用來測試Application的開發的,所有的執行必須藉由這個平台的做測試。

Tips:


(1) Preference的設定: 在Eclipse->Windows->Preferences ( my Eclipse version : 3.3 ), 要指定Android SDK的位置。

(2)Bug error:  第一次跑程式的結果 

> [20xx-xx-xx xx:xx:xx - ddms]Can't bind to local 8600 for debugger
> [20xx-xx-xx xx:xx:xx - ddms]Can't bind to local 8601 for debugger
> [20xx-xx-xx xx:xx:xx - ddms]Can't bind to local 8602 for debugger
> [20xx-xx-xx xx:xx:xx - ddms]Can't bind to local 8603 for debugger
> [20xx-xx-xx xx:xx:xx - ddms]Can't bind to local 8604 for debugger
> [20xx-xx-xx xx:xx:xx - ddms]Can't bind to local 8605 for debugger
> [20xx-xx-xx xx:xx:xx - DeviceMonitor]Sending jdwp tracking request failed!
> ....


前面淺綠色的部分代表的是時間,後面的錯誤訊息分為兩種。
   (A) can't bind to local xxxx for debugger
   (B) sending jdwp tracking request failed

關於(A)訊息,於http://developer.android.com/guide/developing/tools/emulator.htmlNetwork Address space小節內可看到相關訊息。簡單來說,emulator(模擬器)會設定一個虛擬的網路組態,藉由內部的ethernet來模擬。
解決方式: 在windows下,C:\Windows\System32\drivers\etc\hosts。加上,
   
   127.0.0.1        localhost



關於(B)訊息,jdwp 是Java Debug Wire Protocol的縮寫。造成這個錯誤的原因,據下述連結所說,是因為emulator未unluck的關係。要做unluck只要點menu一下就好了。


Fig. 1  Lock mode











Fig.2 Unlock mode
























(3)Be patient: 等待執行的時間有點久,不用擔心。


沒有留言:

張貼留言