does anybody know a way to change sd cards in avd dynamically?
emulator -avd avd_8 -sdcard /TMP/sdcard1.img
the command line starts a new instance of the avd. I need to do the stuff on the running avd
Regards,
Galym
I don't believe you can do this.
The SDCard mounts on boot. Physical devices have hardware sensors to detect insertion/removal of an SD card, which the AVD presumably cannot handle.
I haven't tried this, but you might be able to first unmount the SD card in the Android main menu on the emulator, and then use the avd command to remount a different one.
Related
I have a rooted HTC device, and I want to access the /data/app/ directory on my phone to fix a bug, and I am looking for a way to do this from my PC rather than creating a new emulated environment just to fix that bug. It lead to a looping lock screen, where every three seconds I would end up at the lock screen.
If you have USB debugging enabled, you can try to open "adb shell" and inside of it get root permissions using "su" command. After that you can open any file in any folder through this shell window. Moving in between folders the same as in a Linux, and it's easy to Google how to do that.
I'm working on an app to enable people to upload photos from their phone, and I need to be able to test this functionality out in the AVD via emulator. However the AVDs don't seem to have any photos in storage so I can't use them for testing.
Is there an efficient way to get photos onto the virtual device and preferably keep them there so I can run multiple tests on them? I know I can debug on my phone as well (and have been doing that), however I would prefer to do most of my debugging on the emulator if possible.
I'm using the IntelliJ IDEA for development.
One way would be to open cmd window and type adb shell. You can then create a folder for the images you'd like in the sdcard folder. Then you can exit the shell and push the images to the device using adb push cmd.
It's pretty simple actually.
adb shell
cd sdcard
md directoryName
exit
adb push /sdcard/directoryName /pathToImage
I solved the issue by starting the Android Device Monitor in IntelliJ (Tools>Android>Android Device Monitor), navigating to the File Explorer tab, and copying pictures over to the sdcard>Downloads folder. In the device emulator, I selected 'show SD card' before I was able to use the pictures from that folder. It will probably be easier if I can find out how to put the pics on a device folder instead of SD card, but for now this suffices.
Thanks for the suggestion eclipse, helped me go down the right path.
I use adb shell to access an Android 4.4.2 tablet through a USB connection.
When trying to create a folder in the internal storage (/storage/sdcard0) I get the error 'Out of memory'.
The device has 20+ GB of free space and also has a second sd card mounted as /storage/sdcard1 where the folder can be created just fine.
Both volumes are using msdos.
I tried fsck_msdos to /dev/block/vold/179:9 (the physical path) but found no errors.
Any ideas before factory resetting the thing?
What suggested by Saehun was the correct answer but because I can't give the credits to him I close my own question. Thanks again Saehun!
On the emulator, I can unmount the SD card from the Settings.
I can then mount it on my OS, then unmount it normally.
I haven't been able to figure out how to re-mount it then on the emulator (without rebooting it).
hints:
the adb command remount is unrelated: it's about /system
the emulator command is unrelated: it's only about starting the emulator
mounting the SD card in two places of course messing everything up (I tried)
more:
mount outputs the following:
/dev/block//vold/179:0 /sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
trying to mount again from the shell after unmounting it, using the same options as above, gives a segfault
no idea why the double slash in block//vold, I guess it's just a typo
The developers guide suggests that this isn't possible:
SD Card Emulation
You can create a disk image and then
load it to the emulator at startup, to
simulate the presence of a user's SD
card in the device. To do this, you
can use the android tool to create a
new SD card image with a new AVD, or
you can use the mksdcard utility
included in the SDK.
The sections below describe how to
create an SD card disk image, how to
copy files to it, and how to load it
in the emulator at startup.
Note that you can only load disk image
at emulator startup. Similarly, you
can not remove a simulated SD card
from a running emulator. However, you
can browse, send files to, and
copy/remove files from a simulated SD
card either with adb or the emulator.
The emulator supports emulated SDHC
cards, so you can create an SD card
image of any size up to 128 gigabytes.
While Android will unmount the SD card, the emulator process keeps the backing file open.
$ ls -go /proc/`pidof emulator`/fd | grep sdcard.img
lrwx------ 1 64 2010-05-13 01:50 10 -> /home/x/.android/avd/WithSD.avd/sdcard.img
Someone more familiar with QEMU may be able to provide further insight but, if I were you, I would just try to use NFS to solve this problem.
I tried going to Settings and unmounting the SD card and this worked fine. Give it a try; remounting it is quite simple.
Doesn't seem like this can be done via adb/cli though.
On a relatively new emulator image (AVD) I have about 40mb of free space. How can I expand this?
UPDATE:
Just to be clear... I'm talking about the "Internal phone storage" size, not the SD Card size.
I think:
$ emulator -partition-size <number of megabytes>
is what you're looking for. I tried a few different values in the emulator and the "internal phone storage" setting seemed to reflect the values I passed in.
If you're talking about the SD card size, I believe you'll need to make a new SD card file of a larger file, then load your AVD using the new SD card you've created. They have instructions on how to create an SD card (and load it into an AVD) here: http://developer.android.com/guide/developing/tools/emulator.html#creatingm
Essentially, make the SD card:
$ mksdcard <size> <file>
Then load it into your emulator using the -sdcard argument:
$ emulator -sdcard <filepath>