2011年3月28日 星期一

[android] Install and HelloAndroid Step by Step

[3-1] Selecting packages to install
1. install via homebrew
> brew install android-sdk

2. initialization about Android SDK and AVD.
> android

3. setup the SDK and AVD management.

3-1. switch to "Available" page to select packages you want to install, click button:"install selected"

3-2. switch to "Installed" page to update packages by click button:"Update All..."

[3-2] Updating packages[3-3] "Virtual devices" page
[3-3] new AVD window

3-3. To create a new AVD(Android Virtual Devices): switching to "Virtual Devices" page and clicking button:"new".
(Picture - [3-3] "Virtual devices" page)

On the popped window, we could decide what properties of AVD we want. Select your target carefully, and, remember which target version you select.
(Picture - [3-3] new AVD window)

After clicking button:"Create AVD", this AVD will be showed on the AVD list. now, select a AVD you want to run and click button:"start". There will pop a "Launch Option" window, you could just clicking the button:"Launch".
(Picture - [3-3] "Virtual devices" page)

4. After Init. of Android opening, you could see a nice look.
[4] AVD with waiting for turn-on[4] readied screen

5. Create hello world project via native example.
Do NOT close the AVD. switch to console:
> android create project --package com.example.helloandroid --activity HelloAndroid --target target id --path project-path

Hint: the target id have to be matched with the AVD that we are running. To query the id of target:
> android list targets

for example, the target name of my AVD is Android 2.2, and, in the result of query, I could find out that "id: 4" matches what I need.
...skipped..
id: 4 or "android-8"
Name: Android 2.2
Type: Platform
API level: 8
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WVGA800 (default), WVGA854
...skipped..
now, my creating command will be
> android create project --package com.example.helloandroid --activity HelloAndroid --target 4 --path ~/haha

6. compiling and installing
> cd where-your-project-is
> ant install
wait a few seconds, you should see something like
...skipped...
BUILD SUCCESSFUL
Total time: 9 seconds

7. switch to AVD, you will find out the HelloAndroid app:


竟然寫了兩個小時.. 囧>
godfat大大, 夠詳細了..吧? XD

4 則留言:

  1. 聽說 Simulator 會很耗資源 XD? (單純是來亂的問題 XD)

    回覆刪除
  2. CPU應該頗吃
    沒有特別去看
    不過風扇叫很慘 XD

    RAM 倒是還好
    比起mac上一堆 master
    我覺得普通 XDDD

    開啟要好久
    但是執行起來還算相當順暢哩

    回覆刪除
  3. ㄎㄅ, 是 monster 不是 master ... XDDDDDD

    回覆刪除