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

2011年3月23日 星期三

[xkcd]Duty Calls

"What do you want me to do? LEAVE? Then they'll keep being wrong!"

[xkcd]Pointer

Every computer, at the unreachable memory address 0x-1, stores a secret.
I found it, and it is that all humans ar-- SEGMENTATION FAULT.

[xkcd]Compiling

"Are you stealing those LCDs?"
"Yeah, but I'm doing it while my code compiles."

[xkcd]Sandwich

以後決定把看到有趣的xkcd放在這邊 XD

"Proper User Policy apparently means Simon Says."