Android - How to copy the emulator to a friend for

2019-01-17 08:51发布

I'd like to copy my whole emulator install to another computer with a desktop shortcut which will start it so that my friend can test my app. Has anyone done this?

4条回答
冷血范
2楼-- · 2019-01-17 09:01

Prerequisites: Your friend must have android SDK installed, with required API level, i.e. if you are developing in Android 1.6 your friend should have atleast 1.6 installed

Well considering you situation I will Recommend you should give your friend the <application-name>.apk file that gets generated in your project\bin folder, since any method would either require a device or SDK installed on machine.

You can then ask your friend to install that .apk file with asking him\her to navigate to tools directory of sdk and executing abd install "<.apk folder directory>.<apk-file-name>.apk" when some avd is running, and can be created using android create avd -n <name> -t <targetID> from tools directory of sdk. Complete tutorial on how to create avd is here.

But if you insist on doing a transfer of your entire AVD heres a quick untested tutorial.

Yes you can surely do that, I think. I haven't tried this on some other machine but hope this will help you.

Now

  1. Go to your .android\avd directory, well I don't know about the other OS but in Windows 7 its at C:\Users\<user-name>\.android\avd
  2. Copy the <Android Virtual Device Name>.ini file and <Android Virtual Device Name>.avd folder. Which you can paste it in may be your flash drive or do some online sharing I dont know you choose your way of transferring this data.
  3. Open <Android Virtual Device Name>.ini with any text editor and change path=C:\Users\<your-user-name>\.android\avd\<Android Virtual Device Name>.avd with path=C:\Users\<your-friends-name>\.android\avd\<Android Virtual Device Name>.avd basically you are changing the path where the folder .avd lies.

Now to create a desktop short-cut

  1. Create a blank text file with:

    cd <friends-sdk-directory>\tools
    <root drive of the friends sdk-directory> :
    emulator -avd <Android Virtual Device Name>
    

    and save it as emulator_shortcut.bat

Now when you start the bat file your emulator will start.

Some notes:

Make sure you edit <friends-sdk-directory>,<Android Virtual Device Name>,<your-user-name>,<your-friends-name>,<.apk folder directory>,<apk-file-name> with appropriate values.

查看更多
Anthone
3楼-- · 2019-01-17 09:11

Well, it's not true that you need the complete SDK to run the emulator. If you copy only these files from the Android SDK installation and from your AVD (i.e ~/.android/avd/my.avd)

.
|-- cache.img
|-- config.ini
|-- emulator
|-- emulator-user.ini
|-- kernel-qemu
|-- ramdisk.img
|-- sdcard.img
|-- system.img
|-- userdata.img
|-- userdata-qemu.img
`-- WVGA800
    |-- arrow_down.png
    |-- arrow_left.png
    |-- arrow_right.png
    |-- arrow_up.png
    |-- background_land.png
    |-- background_port.png
    |-- button.png
    |-- controls.png
    |-- hardware.ini
    |-- keyboard.png
    |-- key.png
    |-- layout
    |-- select.png
    `-- spacebar.png

you will be able to start the emulator as

$ ./emulator -sysdir . -kernel kernel-qemu -ramdisk ramdisk.img -system system.img -skindir . -skin WVGA800 -datadir .

and any APK installed and configuration set will persist. Your friend would only need to run this command line which you can put in a script.

查看更多
\"骚年 ilove
4楼-- · 2019-01-17 09:22

To run the emulator properly, you‘ll need three components

  1. The emulator.exe in the SDK_folder/tools/

  2. Android System images and emulator skins

        images are at  <SDK folder>/platforms/<specific platform>/images
        skins are at <SDK folder>/platforms/<specific platform>/skins

    Make sure the images and skins are under the same folder.

    If you use google apis as your target system, the images are at
    <SDK folder>/add-ons/<specific google api version>/images

  3. User images which are also known as avds. You could create them with the AVD manager and the default location of the created AVDs depends on your OS.
    For Win7, it is under C:\Users\<user-name>\.android\avd .

OK. Now you could move these three components to anywhere you want.

Say you've copied the emulator into <My Emulator Dir>,copied the system images and skins into <System Image Dir>, copied you specific avd into <User Image Dir>.

Now You could write a batch file to run the emulator.
<My Emulator Dir>\emulator.exe -sysdir <System Image Dir> -datadir <User Image Dir> -cache <User Image Dir>\cache.img

查看更多
祖国的老花朵
5楼-- · 2019-01-17 09:24

Here is a good article how to copy already created AVD devices to new machine:

http://blahti.wordpress.com/2011/08/24/how-to-export-and-import-android-virtual-device-avd-files/

A short description:

  1. Find your avd folder on you machine, check your user directory. For me, with user name “blahti”, those locations are:

    Windows 7: \users\blahti.android

    Windows XP: C:\Documents and Settings\blahti.android\

    Linux/Mac: ~/.android

  2. In avd folder do: Compress the device.avd folder and the device.ini file. (Replace “device” with the name of the device you want to copy. For example: Evo4g.avd, Evo4g.ini.)

  3. Edit the ini file and make corrections, as needed: (a) user name could be different; (b) change slash in path to Windows or Unix slash.

查看更多
登录 后发表回答