向android模拟器中复制文件报out of memory错误解决

转:http://blog.csdn.net/xiaoxiaosunzhao/article/details/6407745

参照:http://blog.csdn.net/gumanren/archive/2010/09/02/5858266.aspx

在android开发过程中,要经常用到模拟器

原因:

用Elcipse或者是android sdk下的程序启动的模拟器,都会报这个错.

试试直接在命令行下输入

emulator -avd 你创建的avd名字(比如android2.1) -partition-size 128

启动.

然后在复制文件就不会有问题了.

分析:

a. 默认情况下system分区和data分区的信息如下:

# df
/dev: 47048K total, 0K used, 47048K available (block size 4096)
/mnt/asec: 47048K total, 0K used, 47048K available (block size 4096)
/system: 77568K total, 77568K used, 0K available (block size 4096)
/data: 65536K total, 27004K used, 38532K available (block size 4096)

/cache: 65536K total, 1156K used, 64380K available (block size 4096)
/mnt/sdcard: 258064K total, 2K used, 258062K available (block size 512)
/mnt/secure/asec: 258064K total, 2K used, 258062K available (block size 512)
和使用的image是差不多的。

root@romulus-laptop:/work/android/froyo_stk/out/host/linux-x86/sdk/android-sdk_eng.root_linux-x86/platforms/android-2.2.1/images# ll
-rwxrwxrwx 1 root root  1466272 2011-02-28 22:32 kernel-qemu*
-rw-rw---- 1 root root   292233 2011-02-28 22:34 NOTICE.txt
-rw-rw-r-- 1 root root   164888 2011-02-28 22:32 ramdisk.img
-rw-rw---- 1 root root 80912832 2011-02-28 22:32 system.img
-rw-rw---- 1 root root  4105728 2011-02-28 22:32 userdata.img

b. 如果使用-partition-size 128后,指定模拟器的system和data分区的大小是128M

    -partition-size <size>         system/data partition size in MBs
# df
/dev: 47048K total, 0K used, 47048K available (block size 4096)
/mnt/asec: 47048K total, 0K used, 47048K available (block size 4096)
/system: 127104K total, 77904K used, 49200K available (block size 4096)
/data: 127104K total, 27460K used, 99644K available (block size 4096)

/cache: 65536K total, 1212K used, 64324K available (block size 4096)
/mnt/sdcard: 258064K total, 2K used, 258062K available (block size 512)
/mnt/secure/asec: 258064K total, 2K used, 258062K available (block size 512)
注:127104K=124.125M ~ 128M

英文原文:

As android developer, if you use the following command like:

adb push file /system/..

and meet problems like “failed to copy file to /system/…”, such as:

failed to copy ‘file’ to ‘/system/…’: No space left on device
failed to copy ‘file’ to ‘/system/…’: Out of memory

The resolve method is not using the Eclipse or AVD Manager to start the Android emulator, but by use the command first:

$emulator -avd youravdname -partition-size 128

Then you can try the command “adb push file /system/…”, and the problem maybe resolved.




你可能感兴趣的:(向android模拟器中复制文件报out of memory错误解决)