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

本文介绍了解决Android模拟器在复制文件时遇到“没有足够空间”或“内存不足”等问题的方法。通过使用命令行启动模拟器并指定system和data分区大小为128MB,可以有效避免此类错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转:http://blog.youkuaiyun.com/xiaoxiaosunzhao/article/details/6407745

参照:http://blog.youkuaiyun.com/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.




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值