2016年1月11日 星期一

[轉] Creating an Android Emulator Quickly

Here's how to setup an Android Phone emulator, make sure the SDK + tools are installed (see my first post). You might have multiple Android SDK target versions to see which Android versions you have installed run the following:


ff@shoryuken:~/android-sdks/tools$ ./android list
Available Android targets:
----------
id: 1 or "android-7"
Name: Android 2.1
Type: Platform
API level: 7
Revision: 3
Skins: WQVGA400, WQVGA432, HVGA, WVGA800 (default), WVGA854, QVGA
ABIs : armeabi
----------
id: 2 or "android-14"
Name: Android 4.0
Type: Platform
API level: 14
Revision: 3
Skins: WQVGA400, WQVGA432, HVGA, WVGA800 (default), WXGA720, WSVGA, WVGA854, QVGA, WXGA800
ABIs : no ABIs.
----------
id: 3 or "android-15"
Name: Android 4.0.3
Type: Platform
API level: 15
Revision: 1
Skins: WQVGA400, WQVGA432, HVGA, WVGA800 (default), WXGA720, WSVGA, WVGA854, QVGA, WXGA800
ABIs : armeabi-v7a
----------
id: 4 or "Google Inc.:Google APIs:15"Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 4.0.3 (API level 15)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WVGA854, WQVGA400, WSVGA, WXGA720, HVGA, WQVGA432, QVGA, WVGA800 (default), WXGA800
ABIs : armeabi-v7a
Available Android Virtual Devices:
Name: galaxy
Path: /home/ff/.android/avd/galaxy.avd
Target: Android 4.0.3 (API level 15)
ABI: armeabi-v7a
Skin: WVGA800

In my case I would like to emulate id 4 ("id: 4 or "Google Inc.:Google APIs:15"
") so I would run the following command:

ff@shoryuken:~/android-sdks/tools$ ./android create avd -n phoneA -t 4        (choose from android list  Android技術內幕系統卷)
Created AVD 'phoneA' based on Google APIs (Google Inc.), ARM (armeabi-v7a) processor,
with the following hardware config:
hw.lcd.density=240
vm.heapSize=48
hw.ramSize=512


Now to run the emulator we type: 
ff@shoryuken:~/android-sdks/tools$ ./emulator -avd phoneA &
./emulator -avd phoneA -system system.img -data userdata.img -ramdisk ramdisk.img



We're done!

Getting the SDcard can be found here. 
http://blog.jayway.com/2009/04/22/working-with-sd-cards-in-the-android-emulator/

The quick version is simply cd into the tools directory under the android sdk:

$ cd /home/ff/android-sdks/tools
$ ff@shoryuken:~/android-sdks/tools$./mksdcard 128M phoneAsdCard
$ ff@shoryuken:~/android-sdks/tools$ mkdir sdcardA
$ ff@shoryuken:~/android-sdks/tools$ sudo mount -o loop phoneAsdCard sdcardA/
$ ff@shoryuken:~/android-sdks/tools$ ./emulator -avd phoneA -sdcard ./phoneAsdCard

沒有留言:

張貼留言