一月 16, 2010

Android Development

Posted in computer, Development tagged , , , 於 9:57 下午 由 Wing


This is my development notes on Android~

Development Environment:

Mac OS
Android 1.6 SDK
Eclipse 3.5 Galileo


Basic elements:

1. Installation
2. Emulator
3. Android 1.6 NDK
4. SQLite databases


1. Installation:

1.1. Install Android 1.6 SDK
1.2. Install Eclipse 3.5 Galileo http://www.eclipse.org/downloads/
1.3. Install Android Development Tools (ADT) Plugin for Eclipse
http://developer.android.com/sdk/1.6_r1/installing.html


2. Emulator:

To list Available Android targets, go to the sdk tools directory (e.g. /Applications/android-sdk-mac_x86-1.6_r1/tools) and then issue following command:
$ ./android list targets
Available Android targets:

id: 1
Name: Android 1.5
Type: Platform
API level: 3
Revision: 1
Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P
id: 2
Name: Android 1.6
Type: Platform
API level: 4
Revision: 1
Skins: HVGA (default), QVGA, WVGA800, WVGA854
id: 3
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 3
Description: Android + Google APIs
Based on Android 1.5 (API level 3)
Libraries:
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: QVGA-P, HVGA-L, HVGA (default), QVGA-L, HVGA-P
id: 4
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 1.6 (API level 4)
Libraries:
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WVGA854, HVGA (default), WVGA800, QVGA

Note:
VGA (Video Graphics Array) is 640×480
HVGA (Half Video Graphics Array) is 640×240
QVGA (Quarter Video Graphics Array) is 320×240
WVGA (Wide Video Graphics Array) is 800×480

To create emulator:
$ ./android create avd --target 1 --name cupcake
Android 1.5 is a basic Android platform.
Do you wish to create a custom hardware profile [no]
Created AVD ‘cupcake’ based on Android 1.5
$ ./android create avd --target 2 --name donut
Android 1.6 is a basic Android platform.
Do you wish to create a custom hardware profile [no]
Created AVD ‘donut’ based on Android 1.6, with the following hardware config:
hw.lcd.density=160

To list the created emulator:
$ ./android list avd
Available Android Virtual Devices:
Name: cupcake
Path: /Users/wing/.android/avd/cupcake.avd
Target: Android 1.5 (API level 3)
Skin: HVGA
———
Name: donut
Path: /Users/wing/.android/avd/donut.avd
Target: Android 1.6 (API level 4)
Skin: HVGA

To delete emulator:
$ ./android delete avd --name donut
Deleting file /Users/wing/.android/avd/donut.ini
Deleting folder /Users/wing/.android/avd/donut.avd
AVD ‘donut’ deleted.

To start emulator:
$ ./emulator -avd cupcake


3. Android 1.6 NDK:

Seems it can reuse existing native code.
http://developer.android.com/sdk/ndk/1.6_r1/index.html


4. SQLite Databases:

4.1. Start emulator
$ ./emulator -avd cupcake

4.2. Start adb shell
$ ./adb shell

4.3. Go to application directory and create database
#cd data/data/<application_dir>
#mkdir databases
#chmod 777 databases
#sqlite3 <db_name>.db
sqlite>


Reference:

http://developer.android.com/index.html

1 則迴響 »

  1. Nice blog, dude. I enjoy your posting. I am about to create blog about mobile phones, too.

    Thanks!


發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

%d 位部落客按了讚: