Android target類型選擇技巧
不知道大家還記得我們51CTO在一篇對Android虛擬設(shè)備進(jìn)行介紹的文章。對Android有所了解的朋友應(yīng)該知道,虛擬設(shè)備英文簡稱就是AVD。那么在這里大家將會了解內(nèi)容則是其中的一個插件Android target類型的選擇技巧。
Android 1.5中引入了 AVD(Android Virtual Device) 。在模擬器上運(yùn)行你的應(yīng)用程序之前必須首先創(chuàng)建一個你的 AVD(所以,可以理解為 AVD就是一個配置好了的模擬器 )。
創(chuàng)建 AVD你需要運(yùn)行:Android create AVD命令,先看一下它的用法:
- Usage:
- Android [ global options] action [ action options]
- Global options:
- - h - - help This help.
- - s - - silent Silent mode: only errors are printed out.
- - v - - verbose Verbose mode: errors, warnings
and informational messages are pr- inted.
- Action "create AVD" :
- Creates a new Android Virtual Device.
- Options:
- - t - - target Target id of the new AVD [ required]
- - c - - sdcard Path to a shared SD card image, or size
of a new sdcard for the- new AVD
- - p - - path Location path of the directory where
the new AVD will be created- - n - - name Name of the new AVD [ required]
- - f - - force Force creation ( override an existing AVD)
- - s - - skin Skin of the new AVD
從幫助中可以看到,創(chuàng)建一個新的 AVD,你必須要指定的有兩處,一個是 -n,即 name,這個很簡單,給你的 AVD起一個通俗的名字就 ok了。另外一個是 -t,即 target。 SDK1.5中目前有兩種類型的 target: platform,Add-on。 Platform是 Android的平臺 target,add-on是 Android的插件 target。
我們可以先通過命令查看一下當(dāng)前的Android都提供了哪些Android target類型:
- $ Android list targets
- Available Android targets:
- id: 1
- Name: Android 1. 1
- Type: Platform
- API level: 2
- Skins: HVGA ( default ) , HVGA- L, HVGA- P, QVGA- L, QVGA- P
- id: 2
- Name: Android 1. 5
- Type: Platform
- API level: 3
- Skins: HVGA ( default ) , HVGA- L, HVGA- P, QVGA- L, QVGA- P
- id: 3
- Name: Google APIs
- Type: Add- On
- Vendor: Google Inc.
- Description: Android + Google APIs
- Based on Android 1. 5 ( API level 3)
- Libraries:
- * com. google. Android. maps ( maps. jar)
- API for Google Maps
- Skins: HVGA ( default ) , HVGA- L, QVGA- P, HVGA- P, QVGA- L
這些都是 Android 1.5自帶的,如果你使用了一些自己的 add-on,那么這里也會顯示。關(guān)于如何使用自己的 add-on,以后有時間會做介紹。
說了這么多,大家應(yīng)該對 AVD 的Android target類型有了一定的了解?;氐皆},在創(chuàng)建一個 AVD的時候,如何選擇Android target類型呢,這里有幾點(diǎn)需要注意:
最后以一個例子來結(jié)束,例如我想創(chuàng)建一個基本的Android 1.5模擬器 AVD:
- $ Android create AVD - t 2 –n my1p5AVD
如果想查看你目前所有的 AVD,執(zhí)行 Android list AVD,就會看到所有的 AVD詳細(xì)信息。
【編輯推薦】