1.将android-sdk 中的tools目录添加在系统目录中(即环境变量中的path中)
¥ android list targets
Available Android targets:
id: 1 or "android-3"
Name: Android 1.5
Type: Platform
API level: 3
Revision: 4
Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P
id: 2 or "Google Inc.:Google APIs: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: 3 or "android-4"
Name: Android 1.6
Type: Platform
API level: 4
Revision: 3
Skins: HVGA (default), QVGA, WVGA800, WVGA854
id: 4 or "Google Inc.:Google APIs:4"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 2
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
id: 5 or "android-7"
Name: Android 2.1-update1
Type: Platform
API level: 7
Revision: 2
Skins: HVGA (default), QVGA, WQVGA400, WQVGA432, WVGA800, WVGA854
id: 6 or "Google Inc.:Google APIs:7"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 2.1-update1 (API level 7)
Libraries:
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WVGA854, WQVGA400, HVGA (default), WQVGA432, WVGA800, QVGA
id: 7 or "android-8"
Name: Android 2.2
Type: Platform
API level: 8
Revision: 2
Skins: HVGA (default), QVGA, WQVGA400, WQVGA432, WVGA800, WVGA854
id: 8 or "Google Inc.:Google APIs:8"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 2
Description: Android + Google APIs
Based on Android 2.2 (API level 8)
Libraries:
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WVGA854, WQVGA400, HVGA (default), WQVGA432, WVGA800, QVGA
这里列出了4种android模拟器和对应的4个‘google Apis’google把自己提供的应用程序(google map)放在google APIs 这个模拟器类型中,因此要开发google map等google专属的应用程序 就必须建立相应的google APIs 类型的模拟器。
为使Android应用程序可以在模拟器上运行,必须创建模拟器()AVD。
• 在Eclipse中。选择【Windows】 > 【Android SDK and AVD Manager】
• 点击左侧面板的【Virtual Devices】,在右侧点击【New】
• 填入【Name】设备名,选择Target的API,【SD Card】大小小于9MB,【Skin】随便选,Hardware目前保持默认值
• 点击Create AVD即可完成创建AVD
建立一个android-7模拟器
¥android create avd --target 5 --name Android7CPU
【android create avd】建立一个模拟器
【 --target 5】模拟器使用id为5的模拟器类型
【--name Android7CPU】将模拟器命名为“Android7CPU”
结果:
Android 2.1-update1 is a basic Android platform.
Do you wish to create a custom hardware profile [no]
Created AVD 'Android7CPU' based on Android 2.1-update1,
with the following hardware config:
hw.lcd.density=160
再查看现有的模拟器:
¥android list avd
结果:
列出了现有的AVD
Available Android Virtual Devices:
Name: Android7CPU
Path: C:/Documents and Settings/Administrator/.android/avd/Android7CPU.av
Target: Android 2.1-update1 (API level 7)
Skin: HVGA
---------
Name: Mydevice
Path: C:/Documents and Settings/Administrator/.android/avd/Mydevice.avd
Target: Android 2.2 (API level 8)
Skin: HVGA
Sdcard: 9M
开启eclipse【run】>【Debug Configurations..】再左边的列表中选择【Android Application 】下选择 android project 如(Helloword)。
右侧的【Android】选项卡 可以选择Project,和【Launch Action】默认为 Lunch Default Activity
【Target】选项卡中
【deployment target selection mode】中选择【Automatic】后在其下的列表中可以选择AVD,和查看AVD的详细信息。
【Emulator launch parameters】中设设置 仿真器的参数
运行时ctrl+f12 切换AVD的横、竖显示。
Skins: HVGA (default), QVGA, WQVGA400, WQVGA432, WVGA800, WVGA854
为所支持的AVD布景,默认为HVGA,可以在创建AVD的命令行后附加【--skin QVGA -L】选项即可设置为QVGA,“-L”表示(landscape)“-P”
表示(portrait)
Android SDK中提供adb(Android Debugger )命令行工具(需要root权限才能运行)
¥adb shell
切换到 data/app目录中
¥cd data/app
查看列表
¥ls (linux)
¥ dir (windows)
rm命令删除程序
¥ rm xxx.apk
$ android delete avd --name AVDName