发布新日志

  • Android 模拟器之 Market 安装

    2010-07-14 10:57:21

    转载:http://blog.23corner.com/2010/06/16/%E7%AA%AE%E4%BA%BA-android-%E9%96%8B%E7%99%BC%E8%80%85%E6%B8%AC%E8%A9%A6-donut-%E7%89%88%E6%9C%AC-market-%E5%95%8F%E9%A1%8C%E7%9A%84%E6%96%B9%E6%B3%95/

    Android 開發者最頭痛的莫過於程式在 Market 上找不到, 偏偏這問題又無法在自個兒的開發手機上重現, 再加上 Programmer 都很窮 (?) 沒法把出問題的手機通通買回來測, 最後只好忍痛放棄那些殷殷企盼的使用者. 當然網路上有不少這類問題的解法, 痛過一次之後身體就會牢牢記住那些地雷, 似乎往後也沒有厚著臉皮到處借錢買手機的必要. 俗話說工欲善其事, 必先利其器, 如果有便宜又好用的方法可以測試自己的程式, 那再好不過. 小的在這邊提供一個很簡單又便宜的方法讓開發者可以反覆的測, 直到網路斷線為止.

    1. 由於最常出問題的是 Donut 版本 (1.6) 與 QVGA, 所以請先在電腦上安裝 1.6 SDK, 並建立一個 QVGA 的 avd.
    2. 接著到 HTC Developer 網站抓 Android Dev Phone 1 的 1.6 System Image (目前的檔名是 signed-dream_devphone_userdebug-img-14721.zip)
    3. 解開下載的 image 將 system.img 放在 avd 目錄下. Windows 使用者可以在 C:\Documents and Settings\<user>\.android\ 找到你所建立的 avd 目錄, Mac 使用者則可在 ~/.android/avd 找到.
    4. 最後啟動 Emulator, 開機後輸入 Google 帳號相關資料, 即可快樂使用 Donut 的 Market.
    1.5 也可以用類似的方法, 至於 2.0 之後 ? 我再找找.. :-

    在2.1上的安装方法

    1.5, 1.6 之前的版本可以參考上一篇文章, 這邊提供 2.1 的方法, 其實只要 GMS 有修改, 使用方式都會不太一樣, 不過原理大同小異. :-)

    要在 Emulator 上跑 Android Market 有幾點要注意:

    1. 首先要有相對映版本的 Google Android Mobile Service, 通常網路上可以找得到 (GoogleBits-sdk7)
    2. Emulator 的 default partition size 似乎是 66MB, 但是後來的版本 system.img 都超過這個 size, 導致開啟後用 df 查看 free space 都是 0. 所以在啟動 emulator 時, 得加上 -partition-size 96 產生 free space 塞檔案.
    3. Emulator 不會啟動 Google check in service, 少了它便無法登錄 Google 帳號, 所以得先啟動 emulator, 透過 adb pull /system/build.prop 將設定檔案取回, 將 ro.config.nocheckin=yes 這行移除, 再依照後面提到的步驟放回去.

    做好前述步驟, 便可開始進行下一階段工作.

    1. 切換至 avd 的目錄, 將 <sdk_dir>/platforms/android-7/images/system.img 複製過來, 印象中不這麼做資料無法寫入, 而且萬一做錯了得重新 Download 一份 SDK 才能救回, 所以保險起見還是分開使用.
    2. 啟動 Emulator, 別忘了加上 -partition-size 96 這個參數.
    3. 此時可以開啟 ddms 觀察是否啟動完全 (log 停止不再吐出來) 接著執行 adb remount 讓 system partition 可以寫入資料.
    4. 將先前修改的 build.prop 塞回去: adb push build.prop /system/
    5. 解開 Googlebits 那包壓縮檔, 將 system 目錄下列檔案塞入 Emulator 裡
    6. adb push etc/permissions/com.google.android.datamessaging.xml /system/etc/permissions/
      adb push etc/permissions/com.google.android.gtalkservice.xml /system/etc/permissions/
      adb push framework/com.google.android.gtalkservice.jar /system/framework/
      adb push app/EnhancedGoogleSearchProvider.apk  /system/app
      adb push app/GoogleCheckin.apk /system/app
      adb push app/GoogleApps.apk  /system/app
      adb push app/gtalkservice.apk  /system/app
      adb push app/SetupWizard.apk  /system/app
      adb push app/Vending.apk  /system/app
      adb push app/TalkProvider.apk  /system/app
    7. 將 SdkSetup.apk (adb shell rm /system/app/SdkSetup.apk)移除, 這樣重開後就會直接執行 SetupWizard
    8. 關閉 Emulator.
    9. 刪除 cache.img 與 userdata-qemu.img (如果你的avd是通过SDK创建的,C:\Documents and Settings\<user>\.android\ 找到你所建立的 avd 目錄; 如果是通过命令行的行式创建的,找到创建avd时的路径<avd_dir>)
    10. 重新啟動 Emulator, 大功告成 !

    啟動後會出現 SetupWizard, 登入 Google 帳號後即可使用 Android Market ! :D

    2010-06-17 Updated: 2.2 的作法似乎更簡單, 首先可以從 MoDaCo 的論壇上找一下 Froyo 的 ROM, 接下來步驟同前述, 第 5 步裡面塞的 apk 換成 GoogleServicesFramework.apk 與 Vending.apk 即可 ! 看來 dependency 沒這麼複雜囉..



  • 如何在两个模拟器之间互发短信和互通电话

    2010-05-05 13:54:10

    目前在测试ANDROID手机互发短信和互通电话的功能.

    原来一直以为ANDROID模拟器没有办法实现这2个功能,所以一直都是有真实的手机发送短信和互通电话的,所以我的电话费也是哗哗的往下掉.

    后来试着在网上搜索一下看看可否通过2个模拟器来实现互发短信和互通电话的功能,功夫不负有心人,还真被我找到了.

    1. 互通电话:
    (1) 先在一台机器上打开两个模拟器(没有试过在不同机器上,有时间再研究),两个模拟器有不同的端口号,端口号可以在模拟器上的右上角找到(默认的是5554,打开2个模拟器时,系统会自动找不同的端口号)

    (2) 打开打电话的程序,拔打端口号即可.
    2. 互发短信:
    (1) 同上
    (2)打开MESSAGE程序,在To输入端口号即可.

    3. 如图


  • 转载:向Android模拟器打电话和发短消息

    2010-05-04 18:30:51

    转自 http://www.13com.net/article/article.asp?articleid=1041

    在开发Android程序的时候,我们往往需要处理来电或者短消息,但是在开发过程中基本都是通过模拟器来进行调试,那么下面我们就介绍一下如何向模拟器打电话和发短信。

    首先在Eclipse中点击菜单Windows->Open perspective->DDMS进入DDMS视图:

    然后在DDMS视图的Emulator Control视窗中,Incoming number框内填入电话号码(随便填),选择Voice,然后点击Call按钮。

    模拟器上即可显示来自Incoming number的电话呼叫。

    然后在Emulator Tools中选择SMS,并填写短消息内容,然后点击Send按钮。

    相应的模拟器上就会收到来自Incoming number发送的该短消息。

    当然,如果觉得这个方法太麻烦,也可以用命令行的方式来完成上述操作,先通过命令行telnet localhost 5554,进入Android Console,然后就可以使用命令进行一些操作,拨打电话和发送短消息是使用gsm和sms命令。gsm和sms两个命令的参数如下:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    gsm
    allows you to change GSM-related settings, or to make a new inbound phone call

    available sub-commands:
        list             list current phone calls
        call             create inbound phone call
        busy             close waiting outbound call as busy
        hold             change the state of an oubtound call to 'held'
        accept           change the state of an outbound call to 'active'
        cancel           disconnect an inbound or outbound phone call
        data             modify data connection state
        voice            modify voice connection state
        status           display GSM status
    sms
    allows you to simulate an inbound SMS

    available sub-commands:
        send             send inbound SMS text message
        pdu              send inbound SMS PDU

    完成上述一个电话呼叫和短信的完整命令是:

    1
    2
    gsm call 13908888888
    sms send 13908888888 "this is a test sms!"
  • 转载: 如何在Android emulator使用MARKET

    2010-04-11 17:04:20

    Android Market on Emulator (http://doll.javaeye.com/blog/605969)

    文章分类:移动开发 本文转载 原文是在一个外国网站上看到的 地址 http://tech-droid.blogspot.com/2009/11/android-market-on-emulator.html
    blogspot 是被天朝和谐了的网站

    1. 去http://developer.htc.com/adp.html这个网站上下载 System Image 镜像文件,我下载的是Android 1.6 的signed-dream_devphone_userdebug-img-14721.zip。

    2. 在你的Android开发环境 Eclipse中创建一个新的 AVD,SD Card Size 我写的是512M 你随便写多少表示下。

    3. 然后在你的电脑中找到.android这样的目录,该目录下有个avd 文件夹,找到你上一步为你的AVD取的名字那个文件夹。

    4. 解压在网上下载的 zip 文件,把 system.img 复制到 文件下面,重启 模拟器既可,然后你就可以在你的模拟器上登录Android Market搜索程序下载下来用,前提是你有Market 账号。


    5. 有图有真相


  • 导入联系人至Android 手机中.

    2010-04-11 09:30:42

    一、 把 *.csv 文件的打开方式选择为 记事本 打开,然后 保存为 *.txt 文件,

    二、 打开 windows 自带的 Outlook Express 软件,选择 联系人---打开通讯簿

    三、 在通讯簿中选择 文件---导入----其它通讯簿....----文本文件(以逗号分隔)----在 浏览处选择刚才保存好的 *.txt 文件,注意调整对应的号码等选项,可以打开 *.csv 文件参考对应的项。

    四、 导入完成后,在 编辑---全选 之后,用右键复制,在随意地方建新文件夹将之粘贴 进去,此时的文件就变成为 .vcf 格式了。

    五、 将。VCF格式的文件拷贝到你的SDCARD中。

    六、 在CONTACT APP中 Menu - Import/Export - 从SDCARD中导入。
  • 转载:How to create and use SDCard image for Android emulator

    2010-04-11 09:15:44

    http://penguin7.blog.51cto.com/966026/260263
    为了学习使用Android新的组件,先得为Android emulator虚拟一个SD卡。下面就把我的实验工作记录一下(本实验默认已经配置sdk目录下tools到环境变量目录中)。

    1. 使用mksdcard命令创建一个SD卡镜像(目前simulator支持8M~128G的SD卡。)
    例如创建一个名为sdcard2.img的128M(M需大写)SD卡镜像到~/android/sdcard/下,可以这样实现,
    $ mksdcard 128M ~/android/sdcard/sdcard2.img

    2. emulator挂载SD卡镜像

    emulator -avd Map1.5 -sdcard $SDCARD_LOC/sdcard2.img
    这里Map1.5是具有Google Map API 1.5 平台模拟器,同时为了方便我为SD卡镜像配置了登录shell的环境变量,通过cat命令就可以查看到
    $ cat ~/.bashrc

    # ~/.bashrc: executed by bash(1) for non-login shells.
    # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
    # for examples

    #Android SDCard Location variable
    SDCARD_LOC=/home/benjamin/android/sdcard/
    export PATH=$SDCARD_LOC:$PATH

    这样启动模拟器后,模拟器就不会抱怨没有SD卡了。

    3. 向emulator的SD卡镜像写入数据
    方法一:
    在/mnt目录下为SD卡建立一个挂载目录,
    $ mkdir -p /mnt/sdcard

    以loop设备方式将SD卡镜像挂载到刚才建立的那个目录下
    $ sudo mount -o loop /home/benjamin/android/sdcard/sdcard.img /mnt/sdcard/

    向SD卡镜像拷入一首mp3备用,
    $ sudo cp /home/benjamin/Music/I\ need\ to\ wake\ up-Melissa_Etheridge.mp3 /mnt/sdcard/
    查看一下,
    $ ls -l /mnt/sdcard/
    total 5009
    -rwxr-xr-x 1 root root 5128320 2010-01-07 22:16 I need to wake up-Melissa_Etheridge.mp3

    方法二(推荐):
    先启动模拟器并挂载SD Card
    $ emulator -avd android15 -sdcard $SDCARD_LOC/sdcard.img

    使用adb push 把要存储到SD卡镜像的文件压到模拟器SDCard的/sdcard目录下
    $ adb push ~/Music/I\ still\ believe.mp3 /sdcard
    显示:981 KB/s (5684529 bytes in 5.654s)表明传输成功。
    可以通过登录adb shell进一步查看详情
    $ adb shell
    # ls -l /sdcard
    ----rw-rw- system   system    5128320 2010-01-07 14:26 I need to wake up-Melissa_Etheridge.mp3
    ----rw-rw- system   system    5684529 2009-08-14 09:35 I still believe.mp3


    导入mp3后,如果要在模拟器中访问,还需要在模拟器中的Dev tools里面scan一下媒体文件,然后就先可以使用Android emulator自带Music程序查看传入的mp3了,


  • Android Virtual Devices 更改创建目录.

    2010-04-08 19:01:11

    转自:http://hewei1107.blog.163.com/blog/static/1275671372009910101747758/

    AVD quickview

    • You need to create an AVD to run any app in the Android emulator
    • Each AVD is a completely independent virtual device, with its own hardware options, system image, and data storage.
    • You create AVD configurations to model different device environments in the Android emulator.

    In this document

    1. Creating an AVD
      1. Listing targets
      2. Selecting a target
      3. Creating the AVD
      4. Setting hardware emulation options
      5. Default location of the AVD files
    2. Managing AVDs
      1. Moving an AVD
      2. Updating an AVD
      3. Deleting an AVD
    3. Command-line options

    See Also

    1. Android Emulator

    Android Virtual Devices (AVDs) are configurations of emulator options that let you better model an actual device.

    Each AVD is made up of:

    • A hardware profile.  You can set options to define the hardware features of the virtual device. For example, you can define whether the device has a camera, whether it uses a physical QWERTY keyboard or a dialing pad, how much memory it has, and so on.
    • A mapping to a system image.  You can define what version of the Android platform. will run on the virtual device. You can choose a version of the standard Android platform. or the system image packaged with an SDK add-on.
    • Other options.  You can specify the emulator skin you want to use with the AVD, which lets you control the screen dimensions, appearance, and so on. You can also specify the emulated SD card to use with the AVD.
    • A dedicated storage area on your development machine, in which is stored the device's user data (installed applications, settings, and so on) and emulated SD card.

    You can create as many AVDs as you need, based on the types of devices you want to model and the Android platforms and external libraries you want to run your application on.

    In addition to the options in an AVD configuration, you can also specify emulator command-line options at launch or by using the emulator console to change behaviors or characteristics at run time. For a complete reference of emulator options, please see the Emulatordocumentation.

    To create and manage AVDs, you use the android tool provided in the Android SDK. For more information about how to work with AVDs from inside your development environment, see Developing in Eclipse with ADT or Developing in Other IDEs, as appropriate for your environment.

    Creating an AVD

    The Android SDK does not include any preconfigured AVDs, so you need to create an AVD before you can run any application in the emulator (even the Hello World application).

    To create an AVD, you use the android tool, a command-line utility available in the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; "><sdk>/tools/</COde> directory. Managing AVDs is one of the two main function of the android tool (the other is creating and updating Android projects). Open a terminal window and change to the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; "><sdk>/tools/</COde>directory, if needed

    To create each AVD, you issue the command <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">android create avd</COde>, with options that specify a name for the new AVD and the system image you want to run on the emulator when the AVD is invoked. You can specify other options on the command line also, such as to create an emulated SD card for the new AVD, set the emulator skin to use, or set a custom location for the AVD's files.

    Here's the command-line usage for creating an AVD:

    android create avd -n <name> -t <targetID> [-<option> <value>] ...

    You can use any name you want for the AVD, but since you are likely to be creating multiple AVDs, you should choose a name that lets you recognize the general characteristics offered by the AVD.

    As shown in the usage above, you must use the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-t</COde> (or <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">--target</COde>) argument when creating a new AVD. The argument sets up a mapping between the AVD and the system image that you want to use whenever the AVD is invoked. You can specify any Android system image that is available in your local SDK — it can be the system image of a standard Android platform. version or that of any SDK add-on. Later, when applications use the AVD, they'll be running on the system that you specify in the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-t</COde> argument.

    To specify the system image to use, you refer to its target ID — an integer — as assigned by the android tool. The target ID is not derived from the system image name, version, or API Level, or other attribute, so you need to have the android tool list the available system images and the target ID of each, as described in the next section. You should do this before you run the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">android create avd</COde> command.

    Listing targets

    To generate a list of system image targets, use this command:

    android list targets

    The android tool scans the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; "><sdk>/platforms</COde> and <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; "><sdk>/add-ons</COde> directories looking for valid system images and then generates the list of targets. Here's an example of the command output:

    Available Android targets:id:1    Name: Android 1.1    Type: platform    API level: 2    Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-Pid:2    Name: Android 1.5    Type: platform    API level: 3    Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-Pid: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

    Selecting a target

    Once you have generated the list of targets available, you can look at the characteristics of each system image — name, API Level, external libraries, and so on — and determine which target is appropriate for the new AVD.

    Keep these points in mind when you are selecting a system image target for your AVD:

    • The API Level of the target is important, because your application will not be able to run on a system image whose API Level is less than that required by your application, as specified in the<COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">minSdkVersion</COde> attribute of the application's manifest file. For more information about the relationship between system API Level and application <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">minSdkVersion</COde>, see Specifying Minimum System API Version.
    • Creating at least one AVD that uses a target whose API Level is greater than that required by your application is strongly encouraged, because it allows you to test the forward-compatibility of your application. Forward-compatibility testing ensures that, when users who have downloaded your application receive a system update, your application will continue to function normally.
    • If your application declares a <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">uses-library</COde> element in its manifest file, the application can only run on a system image in which that external library is present. If you want your application to run on the AVD you are creating, check the application's <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">uses-library</COde> element and select a system image target that includes that library.

    Creating the AVD

    When you've selected the target you want to use and made a note of its ID, use the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">android create avd</COde> command to create the AVD, supplying the target ID as the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-t</COde> argument. Here's an example that creates an AVD with name "my_android1.5" and target ID "2" (the standard Android 1.5 system image in the list above):

    android create avd -n my_android1.5 -t 2

    If the target you selected was a standard Android system image ("Type: platform"), the android tool next asks you whether you want to create a custom hardware profile.

    Android 1.5 is a basic Android platform.Do you wish to create a custom hardware profile [no]

    If you want to set custom hardware emulation options for the AVD, enter "yes" and set values as needed. If you want to use the default hardware emulation options for the AVD, just press the return key (the default is "no"). The android tool creates the AVD with name and system image mapping you requested, with the options you specified.

    If you are creating an AVD whose target is an SDK add-on, the android tool does not allow you to set hardware emulation options. It assumes that the provider of the add-on has set emulation options appropriately for the device that the add-on is modeling, and so prevents you from resetting the options.

    For a list of options you can use in the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">android create avd</COde> command, see the table in Command-line options for AVDs, at the bottom of this page.

    Setting hardware emulation options

    When are creating a new AVD that uses a standard Android system image ("Type: platform"), the android tool lets you set hardware emulation options for virtual device. The table below lists the options available and the default values, as well as the names of properties that store the emulated hardware options in the AVD's configuration file (the config.ini file in the AVD's local directory).

    Characteristic Description Property
    Device ram size The amount of physical RAM on the device, in megabytes. Default value is "96". hw.ramSize
    Touch-screen support Whether there is a touch screen or not on the device. Default value is "yes". hw.touchScreen
    Trackball support Whether there is a trackball on the device. Default value is "yes". hw.trackBall
    Keyboard support Whether the device has a QWERTY keyboard. Default value is "yes". hw.keyboard
    DPad support Whether the device has DPad keys. Default value is "yes". hw.dPad
    GSM modem support Whether there is a GSM modem in the device. Default value is "yes". hw.gsmModem
    Camera support Whether the device has a camera. Default value is "no". hw.camera
    Maximum horizontal camera pixels Default value is "640". hw.camera.maxHorizontalPixels
    Maximum vertical camera pixels Default value is "480". hw.camera.maxVerticalPixels
    GPS support Whether there is a GPS in the device. Default value is "yes". hw.gps
    Battery support Whether the device can run on a battery. Default value is "yes". hw.battery
    Accelerometer Whether there is an accelerometer in the device. Default value is "yes". hw.accelerometer
    Audio recording support Whether the device can record audio. Default value is "yes". hw.audioInput
    Audio playback support Whether the device can play audio. Default value is "yes". hw.audioOutput
    SD Card support Whether the device supports insertion/removal of virtual SD Cards. Default value is "yes". hw.sdCard
    Cache partition support Whether we use a /cache partition on the device. Default value is "yes". disk.cachePartition
    Cache partition size Default value is "66MB". disk.cachePartition.size

    Default location of the AVD files

    When you create an AVD, the android tool creates a dedicated directory for it on your development computer. The directory contains the AVD configuration file, the user data image and SD card image (if available), and any other files associated with the device. Note that the directory does not contain a system image — instead, the AVD configuration file contains a mapping to the system image, which it loads when the AVD is launched.

    The android tool also creates a <AVD name>.ini file for the AVD at the root of the .android/avd directory on your computer. The file specifies the location of the AVD directory and always remains at the root the .android directory.

    By default, the android tool creates the AVD directory inside <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">~/.android/avd/</COde> (on Linux/Mac), <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">C:\Documents and Settings\<user>\.android\</COde> on Windows XP, and<COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">C:\Users\<user>\.android\</COde> on Windows Vista. If you want to use a custom location for the AVD directory, you can do so by using the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-p <path></COde> option when you create the AVD:

    android create avd -n my_android1.5 -t 2 -p path/to/my/avd

    If the .android directory is hosted on a network drive, we recommend using the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-p</COde> option to place the AVD directory in another location. The AVD's .ini file remains in the .android directory on the network drive, regardless of the location of the AVD directory.

    Managing AVDs

    The sections below provide more information about how to manage AVDs once you've created them.

    Moving an AVD

    If you want to move or rename an AVD, you can do so using this command:

    android move avd -n <name> [-<option> <value>] ...

    The options for this command are listed in Command-line options for AVDs at the bottom of this page.

    Updating an AVD

    If, for any reason, the platform/add-on root folder has its name changed (maybe because the user has installed an update of the platform/add-on) then the AVD will not be able to load the system image that it is mapped to. In this case, the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">android list targets</COde> command will produce this output:

    The following Android Virtual Devices could not be loaded: Name: foo Path: <path>/.android/avd/foo.avd Error: Invalid value in image.sysdir. Run 'android update avd -n foo'

    To fix this error, use the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">android update avd</COde> command to recompute the path to the system images.

    Deleting an AVD

    You can use the android tool to delete an AVD. Here is the command usage:

    android delete avd -n <name>

    When you issue the command, the android tool looks for an AVD matching the specified name deletes the AVD's directory and files.

    Command-line options for AVDs

    The table below lists the command-line options you can use with the android tool.

    Action Option Description Comments
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">list avds</COde>   List all known AVDs, with name, path, target, and skin.  
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">create avd</COde> <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-n <name> or 

    </COde>

    The name for the AVD. Required
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-t <targetID></COde> Target ID of the system image to use with the new AVD. Required. To obtain a list of available targets, use <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">android list targets</COde>.
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-c <path></COde> or 

    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-c <size>[K|M]</COde>

    The path to the SD card image to use with this AVD or the size of a new SD card image to create for this AVD. Examples: <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-c path/to/sdcard</COde> or <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-c 1000M</COde>
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-f</COde> Force creation of the AVD By default, if the name of the AVD being created matches that of an existing AVD, the android tool will not create the new AVD or overwrite the existing AVD. If you specify the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-f</COde> option, however, the android tool will automatically overwrite any existing AVD that has the same name as the new AVD. The files and data of the existing AVD are deleted.
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-p <path></COde> Path to the location at which to create the directory for this AVD's files.  
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-s <name></COde> or 

    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-s <width>-<height></COde>

    The skin to use for this AVD, identified by name or dimensions. The android tool scans for a matching skin by name or dimension in the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">skins/</COde> directory of the target referenced in the <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-t <targetID></COde> argument. Example: <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-s HVGA-L</COde>
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">delete avd</COde> <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-n <name></COde> Delete the specified AVD. Required
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">move avd</COde> <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-n <name></COde> The name of the AVD to move. Required
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-p <path></COde> The path to the new location for the AVD.  
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">-r <new-name></COde> Rename the AVD.  
    <COde style="color: rgb(0, 112, 0); font-family: monospace; line-height: 1em; ">update avds</COde>
  • Android: 如何使用ADB

    2010-04-06 15:14:13

    转自:http://rayleung.javaeye.com/blog/480908

    Android adb的使用略解

    文章分类:移动开发 关键字: android,adb

    安卓网的一个帖子,写得不错,记下来

    ADB全称Android Debug Bridge, 是android sdk里的一个工具, 用这个工具可以直接操作管理android模拟器或者真实的andriod设备(如G1手机).

    它的主要功能有:


    • 运行设备的shell(命令行)
    • 管理模拟器或设备的端口映射
    • 计算机和设备之间上传/下载文件
    • 将本地apk软件安装至模拟器或android设备



    ADB是一个 客户端-服务器端 程序, 其中客户端是你用来操作的电脑, 服务器端是android设备.

    先说安装方法, 电脑上需要安装客户端. 客户端包含在sdk里. 设备上不需要安装, 只需要在手机上打开选项settings-applications-development-USBdebugging.

    对于Mac和Linux用户, 下载好的sdk解压后, 可以放~或者任意目录. 然后修改~/.bash_profile文件, 设置运行环境指向sdk的tools目录.
    具体是打开~/.bash_profile文件(如果没有此文件也可以自行添加), 在里面加入一行:

    export PATH=${PATH}:<你的sdk目录>/tools

    然后就可以使用adb命令了.

    嫌安装麻烦的同学其实也可以省去上面安装步骤, 直接输入完整路径来使用命令
    对于windows xp用户, 需要先安装usb驱动  android_usb_windows.zip (1.33 MB) , 然后如果你只打算使用adb而不想下载整个sdk的话, 可以下载这个单独的adb工具包  adb_win.zip (571.56 KB) 下载后解压, 把里面 adb.exe 和 AdbWinApi.dll 两个文件放到系统盘的 windows/system32 文件夹里就可以了

     

    ADB常用的几个命令
    1. 查看设备

    • adb devices

    这个命令是查看当前连接的设备, 连接到计算机的android设备或者模拟器将会列出显示

    2. 安装软件

    • adb install <apk文件路径>

    这个命令将指定的apk文件安装到设备上

    3. 卸载软件

    • adb uninstall <软件名>
    • adb uninstall -k <软件名>

    如果加 -k 参数,为卸载软件但是保留配置和缓存文件.

    4. 登录设备shell

    • adb shell
    • adb shell <command命令>

    这个命令将登录设备的shell.
    后面加<command命令>将是直接运行设备命令, 相当于执行远程命令

    5. 从电脑上发送文件到设备

    • adb push <本地路径> <远程路径>

    用push命令可以把本机电脑上的文件或者文件夹复制到设备(手机)

    6. 从设备上下载文件到电脑

    • adb pull <远程路径> <本地路径>

    用pull命令可以把设备(手机)上的文件或者文件夹复制到本机电脑

    7. 显示帮助信息

    • adb help

    这个命令将显示帮助信息

  • Android vnc server 安装

    2010-04-06 14:38:22

    想通过PC来控制G1 phone(android), 在 MARKET找了半天,没有找到VNC server,只有VNC viewer,在网上搜索了一下,发现了一个叫做ANDROIDVNCSERVER的东东。以下是安装过程。
    转自:http://blog.csdn.net/stevenliyong/archive/2010/03/10/5365148.aspx
    名称:Android VNC Server on G1 (PC 远程控制 Android 手机) I found a vnc server for G1.

    1. Original vnc project

    http://code.google.com/p/android-vnc/

    This one could not be used on G1, because it need build a special keyboard driver into kernel

    2. Forked vnc server

    http://code.google.com/p/android-vnc-server/

    Forked from android-vnc project on google code.

    The original android-vnc need build a special keyboard driver into kernel. It's not necessary. Also the touch event support is added in this version.

    First download and install the binary

     http://code.google.com/p/android-vnc-server/downloads/list

    If you have adb on server:

    #adb push androidvncserver /data 
    #adb shell
    /data/androidvncserver
    Or you can just copy the downloaded file androidvncserver to the /sdcard, 
    Then umount the sdcard and launch the terminal from your G1, then type
    # su    <-  I have root access, I'm not sure whether the following steps work without root access.
    # cp /sdcard/androidvncserver /data/
    # chmod a+x /data/androidvncserver
    # /data/androidvncserver &
    And finally: 

    Run vnc viewer from hose PC.

    Here I use

    http://downloads.sourceforge.net/vnc...3.10-setup.exe 

    make sure the connection address with port 5901 : 192.168.0.101:5901

    Now, I can remote control my phone from host pc.

    在安装的过程上,遇到了以下问题, 在使用chmod命令时,总是提示,permission denied,在chmod 命令后添加了权限 777(即可执行又可读写的权限) 就可以了。

    另附图:通过 ADB启动VNC SERVER时的图

  • Android模拟器安装 with windows xp

    2010-03-04 15:12:55

    参见:

    http://androidandme.com/2009/10/news/how-to-install-android-sdk-and-play-with-android-2-0-in-the-emulator/

    Google has released the Android 2.0 SDK as of October 27th, 2009. We know how eager everyone has been to get their hands on Android 2.0, so we have decided to write up instructions so that anyone may download and install the SDK, then create and run an emulator instance.

    Note, the emulator is not intended to duplicate any particular device, so treat this more as a look at some of the core new features of Android 2.0 than an emulation of any current or future device. Also, things that require hardware features are not available in the emulator. No multi-touch in here guys (unless you manage to get two mice to work?).

    Enough of the talk, let’s get down to business.

    1)      Download appropriate file for your system from http://developer.android.com/sdk/index.html

    http://code.google.com/android/download.html

    2)      Extract to desired location

    3)      Run “SDK Setup.exe” (or the equivalent for your system)

    Launch sdksetup.ext

    Launch sdksetup.ext

    a.       If you receive an error message stating “Failed to fetch url…” then you will have to force the Setup program to use http in lieu of https.

    Got this error? Follow the steps.

    Got this error? Follow the steps.

    i.      Close the “Refresh Sources” window

    ii.      Cancel the “Choose Packages to Install” window

    iii.      Select “Settings” from the left side of the “Android SDK and AVD Manager” window

    iv.      Check the box labeled “Force https://… sources to be fetched using http://…”

    v.      Click “Save and Apply”

    vi.      Close and restart the SDK Setup program

    4)      Choose the packages that you wish install

    Select only the packages you need.

    Select only the packages you need.

    a.       If you are only interested in trying out the Android 2.0 Emulator

    i.      Reject everything except “SDK Platform. Android 2.0. API 5, revision 1” by selecting each item then selecting the Reject option

    b.      If you plan to develop Android applications and Games, you may wish to Accept All

    c.       Click “Install Selected”

    5)      Allow the selected packages to download and install then close the “Installing Archives” window

    6)      Create a new Android Virtual Device (AVD)

    These are the settings to emulate the Moto Droid.

    These are the settings to emulate the Moto Droid.

    a.       Select “Virtual Devices” from the left side of the “Android SDK and AVD Manager” window

    i.      Click “New”

    ii.      Enter a Name

    iii.      Choose a Target

    iv.      Enter a size for the emulated SD Card

    v.      Choose a Skin

    1.      To emulate current hardware such as the G1, MyTouch 3G, Hero, etc…

    a.       Leave the default value

    2.      To emulate the Motorola Droid

    a.       Choose WVGA 854

    3.      To emulate other devices

    a.       Choose anything else

    vi.      Click “Create AVD”

    7)      Start your newly created Virtual Device

    A successfully created AVD.

    A successfully created AVD.

    a.       Choose the Virtual Device from the list

    b.      Click “Start…”

    c.       Click “Launch”

    Just click launch.

    Just click launch.

    8)      Allow copious time for Emulator to start up

    First startup will take a few minutes.

    First startup will take a few minutes.

    9)      Enjoy!

    Android 2.0
  • iPhone 2.2.1升级到3.0

    2009-11-19 11:20:45

    因为一直在针对iPhone软件进行测试,其中难免会遇到iPhone升级的问题.
    以下有一篇很适合初次接触iPhone的人员使用,在此转载,与之共勉.

    1. 升级篇: http://www.naodi.net/blog/ipod-touch-2-generation-os-3-0-upgrade-crack-perfect-the-new-system-escape-fig-text-tutorials/
    2. 通过电脑访问IPHONE篇:http://hi.baidu.com/kxw102/blog/item/a4e4a1c5aa82caa08326acab.html


  • Blackberry 如何支持CMWAP&CMNET?

    2009-06-24 09:56:13

    引用地址:http://bbs.51blackberry.com/archiver/?tid-65.html

    cmwap和cmnet的区别

    本文来源于网络,希望对大家有小帮助

    很多人都知道这是中国移动提供的两个不同的接入点,
    但是说到区别,恐怕很多玩家都不是十分清楚。其实,CMWAP 和 CMNET 只是中国移动人为划分的两个GPRS接入方式。前者是为手机WAP上网而设立的,后者则主要是为PC、笔记本电脑、PDA等利用GPRS上网服务。它们在 实现方式上并没有任何差别,但因为定位不同,所以和CMNET相比,CMWAP便有了部分限制,资费上也存在差别。

    WAP只是一种GPRS应用模式,它与GRPS的接入方式是无关的。WAP应用采用的实现方式是“终端+WAP网关+WAP服务器”的模式,不同于一般 Internet的“终端+服务器”的工作模式。主要的目的是通过WAP网关完成WAP-WEB的协议转换以达到节省网络流量和兼容现有WEB应用的目 的。WAP网关从技术的角度讲,只是一个提供代理服务的主机,它不一定由网络运营商提供。但据我所知,中国移动GPRS网络目前只有唯一的一个WAP网 关:10.0.0.172,有中国移动提供,用于WAP浏览(HTTP)服务。有一点需要注意,WAP网关和一般意义上的局域网网关是有差别的,标准的 WAP网关仅仅实现了HTTP代理的功能,并未完成路由、NAT等局域网网关的功能。这就决定了它在应用上所受到的限制。

    为了从应用中区别两者的定位,中国移动对CMWAP作了一定的限制,主要表现在CMW
    AP接入时只能访问GPRS网络内的IP(10..*),而无法通过路由访问Internet。我们
    用CMWAP浏览Internet上的网页就是通过WAP网关协议或它提供的HTTP代理服务实现的。也就是需要通过中国移动GPRS网络唯一的一个 WAP网关:10.0.0.172。CMNET拥有完全的Internet访问权,这里就不多说了,主要让我们来看看CMWAP。因为有了上面提到的限 制,CMWAP的适用范围就要看WAP网关所提供的支持了。目前,中国移动的WAP网关对外只提供HTTP代理协议(80和8080端口)和WAP网关协 议(9201端口)。因此,只有满足以下两个条件的应用才能在中国移动的CMWAP接入方式下正常工作:
    1. 应用程序的网络请求基于HTTP协议。
    2. 应用程序支持HTTP代理协议或WAP网关协议。

    而cmnet则不受任何的限制。
    说白了就是说通过cmwap的方式访问,需要走中国移动的网关通过http协议去连接,
    这样的后果就是速度会变慢,相信很多朋友都用过代理服务器吧,对,就是那个感觉,而通过cmnet来连接的,就是直接连接到无限乾坤在internet上 的服务器,速度会比cmwap的快一些。说完了速度,就该说价格了,如果玩家没有采用套餐的话,那cmwap和cmnet都是一样的,1kb三分钱,或者 订了一个xx元包xM的套餐,超出部分1k一分钱,这种时候,同等价格都一样,据我了解,cmwap版本流量会大一些,所以还是用cmnet比较好,又快 又省钱。但是对于很多地方的动感地带用户而言,情况可能有些不同,相当一些地方的动感地带只能访问cmwap,不能访问cmnet,所以没地选择了,还有 一些地方有动感地带的包月上网卡,有10元、20元、50元的等等,具体的要看当地的资费政策了,而这些包月卡通常只包cmwap的流量,这个时候如果用 cmnet还要另外付费,所以建议这些用户还是使用cmwap吧。最后总结一下,如果玩家的手机卡只能访问cmwap或者有cmwap包月的套餐,那么您 就使用cmwap连接来游戏,否则使用cmnet连接是更好的选择

    所以,一句话,有wap包月的地区就使用wap包月上网,没有包月业务的就用cmnet,反正都是按流量算钱,为什么不选择快一点的呢(但还是要提醒大家,按流量计费产生的费用是巨大的,要多多注意)

    完美ServiceBook 让BB自带浏览器使用CMWAP/CMNET双接入


    引用地址:http://www.3g303.com/htm_data/50/0906/22838.html
    这个ServiceBook可实现让BB自带浏览器使用Wap和Net双接入点,并且ServiceBook包含Email、Push、MMS条目!已经有网友测试联通可用,ServiceBook条目部分参考此帖以及其他前辈的研究成果! !J<Xel {  
    DJ<+" .v!  
    此ServiceBook无IPPP条目不可用于激活,因此只针对上网免激活的BB机型! >AX_"Q~  
    ]?H12xz  
    ServiceBook导入方法(不用删除和重启): ,'HjL:r  
    y[85eM  
    首 先在BB上进入 “Option 选项”->“Advanced Option 高级选项”->“Service Book 服务与预订”,然后按住(是按住)Alt,再依次按键“S-B-E-B”(如果是增强型SureType键盘按S的话就是两次A),然后然后会出现提示 “Legacy SB Restore Enable”,意思就是现在可以导入SB了(这样就不用把浏览器删来删去,可以直接导入)! rf|Nu3AJ  
    d WkQ NFKF  
    然 后用USB连接BB,在PC上打开Desktop Manager 桌面管理器,选择“备份和恢复”,继续选择“高级”,在弹出的IPD管理窗口中点击“文件”选项,“打开”我下面提供的Service Book的IPD文件,单机向右的箭头,即开始导入Service Book,导入完成后关闭桌面管理器,断开USB连接即可开始在BB上开始用CMWAP/CMNET双接入自带浏览器了! '}(>s%~  
    h M7 SGEV  
    双接入切换方法: ?2da6v,t  
    FWW@t1)  
    按 B或者手动打开自带浏览器,会提示“Invalid address http:// 无效的网址”(因为我删除了自动载入的主页,所以会这么提示)。在浏览器界面打开菜单选择“Option 选项”(按快捷键O也可打开选项),选择第二项“General Properties 常规属性”,进入常规属性设置界面后,看见第一项“Default Browser 默认浏览器”,若要使用CMWAP则选择“WAP Browser”,使用CMNET则选择“NET Browser” N}%AUm/L  
    %G 2g @2  
    在添加书签的时候,可设置这个书签对应的接入点Net还是Wap,这样就可以不用切换常规属性中的浏览器设置而对特定的书签使用特定的接入点! b3[[ Ah-  
    KzV|::S^  
    CMNET下访问各手机网站可识别黑莓UA,经测试,用cmnet访问GOOGLE移动版可直接下载Google的黑莓软件,自动匹配黑莓机型! . :Ob^b3<t  
    CMNET下还可以下载大文件,因为CMWAP的9201端口只能下载333KB的单个文件,我改成80或8080后会上不了网(很诡异),而CMNET是没有文件大小限制的! E_A 5KLP  
      6?%$e$s  
    Uaux0W  
    &F :.V$  
    P.S 关于”Invalid address http://” 出现只需按回车,然后就可以使用各种快捷键来继续操作,比如打开新地址,书签等, 也不会载入多余首页耗费流量,话说我是有意删除首页的,窃以为这是最佳方案!如果被”Invalid address http://”吓到,请不要惊慌! Q.eD:@%iE  
    m?yztm~u  
    第一种Service Book,此SB包含6个条目,直接导入无需重启即可使用,移动和联通用户均可下载这个 ServiceBook_Net_Wap_Email.rar (1 K) 下载次数:2 s 7w A3|9  
    wAW{{ p  
    二 种Service Book,此SB包含2个条目(CMNET和EMAIL),导入后需重启BB后会生成另外4个条目,在CMWAP模式下,会出现自动载入的首页(喜欢移动 梦网首页的下载这个吧),而且在选择浏览器时WAP模式名称为“Monternet”,此Service Book只针对移动用户! ,Nw2cv}D  
    cmnet_email.rar (1 K) 下载次数:2 _8y4U 
  • Blackberry 中文支持

    2009-06-23 10:58:54

    最近在对用黑莓手机测试ORACLE的软件,有一些本地化的测试要求能显示中文和输入中文.当时黑莓手机是从国外邮寄过来的,系统也是提前装好的,而且不支持中文.Google了一下,发现几篇不错的文章,共享一下.
    1.Reading Chinese on Your Blackberry: http://www.certifiedchinesetranslation.com/read-Chinese-on-Blackberry.html
    (1)If You just want to read Chinese, without any input, You could try this BlackBerry Chinese character pack:
    net_rim_font_chinese
    (2)Make sure you have the latest Blackberry Desktop Manager installed. Blackberry Desktop Software(note:download eastAsia version)
    (3)Install it to the PC by running the file you downloaded
    (4)On your PC, locate the vendor.xml file and delete it. It's located in c:\program files\common files\research in motion\apploader
    (5)Make sure the Blackberry is connected with
    PC and Click on loader.exe to open Desktop Manager which located in c:\program files\common files\research in motion\apploader.
    (6)
    After a short while You see a window 'Device application selection', click on Add, select the net_rim_font_chinese pack
    (7)Click on Next
    (8)Once it's done loading the new Blackberry Desktop Software it will reboot, then you can see the chinese character with your blackberry
    2.Input Chinese on Blackberry: http://yolearnchinese.com/archives/blackberry-chinese-input-method-support

Open Toolbar