2013年11月1日 星期五

Android note (1) - How to start.

常常在重新學習,目錄更動或忘記指令build不起來是家常便飯了。

1. 建立一個新的android專案。

android create project -t 1 -n hello -p /home/teng/work/hello -a hello -k com.hello.myapp
  -n --name          : Project name. 可以用 android list targets 查看
  -t --target        : Target ID of the new project. [required]
  -k --package       : Android package name for the library. [required]
  -g --gradle        : Use gradle template.
  -v --gradle-version: Gradle Android plugin version.
  -p --path          : The new project's directory. [required]


2. 先使用adb,找到自已的手機裝置ID

adb devices
   List of devices attached 
   HT214VZxxxxx    device <=== 自已的設備 (前置作業也有一些,想到再補)


3.  工欲善其事必先利其器,建立一個簡單的Makefile加速debug.

#############################                                                                                            
all:
   ctags -R
#  cscope -Rb
   ant debug
   adb -s HT214VZxxxxx install -r bin/hello-debug.apk.

debug:
   konsole -e adb logcat

clean:
   ant clean
##############################

4. 輸入make自動將程式編譯並載入手機執行,
    輸入make debug則會在另個console顯示除錯訊息(蠻方便的)


打開快樂的vim邊吐血....