I have some items in my ubuntu 12.04 desktop. I want to transfer them into the Sdcard of one of the avds in my android emulator (android-sdk-linux) which I have installed on the same system.
Like to know how to do the above.
I have some items in my ubuntu 12.04 desktop. I want to transfer them into the Sdcard of one of the avds in my android emulator (android-sdk-linux) which I have installed on the same system.
Like to know how to do the above.
1. Using command line: Here's how you can copy files to an SD card image.
You have to use adb push
to copy files from Desktop to Emulator and adb pull
for the reverse. Here's the syntax to copy files to or from an Emulator/Device Instance:
Copy from desktop to emulator:
adb push <local> <remote>
Copy from emulator to desktop:
adb pull <remote> <local>
Here <local>
is path of file / folder on your desktop and <remote>
is path of file / folder on your emulator.
Here is an example:
adb push foo.txt /sdcard/foo.txt
foo.txt will be pushed (copied) to the emulator.
2. Using DDMS UI: Here's how to work with emulator's file system using DDMS.
I personally prefer the adb pull and adb push commands as you can copy multiple files (in a single directory) with just one line command, using DDMS you can copy only one file at a time (no directory).
To transfer data from desktop to an emulator's SdCard on Linux do this:
Let's create a 64MB sd card for our Android emulator. From a terminal do this:
# cd ~/android-sdk-linux/tools
# ./mksdcard 64M ~/Desktop/sdcard.iso
Now you can use the 'Eclipse Android SDK and AVD Manager' to create a new Android virtual device that can use the path to the sd card you created.
Write Data to the SD Card:
From a terminal:
# cd ~/android-sdk-linux/tools
# ./ddms
This will start the Dalvik Debug Monitor Server. Then:
Now from inside your code you can get to the sd card's path with:
Environment.getExternalStorageDirectory()
More you can read here.
You can also upload the file to your online drive of choice and share it to anyone with the link, copy and paste the link into the browser of the emulator and download it that way.