问题描述:

I have a weird problem with the Android emulator. I have created a virtual device through Android AVD manager (newly created emulator with platform 2.1 and API level 7). I have tried with standard settings and with added hardware parameter for larger (256 MB) device RAM size but nothing changed.

I need to come files to the system partition to test a project (called haggle), but for some reason the system partition has no space from start.

aa [email protected] /home/haggle-0.2-android

$ adb -s emulator-5554 shell

# df

df

/dev: 47084K total, 0K used, 47084K available (block size 4096)

/sqlite_stmt_journals: 4096K total, 0K used, 4096K available (block size 4096)

/system: 73600K total, 73600K used, 0K available (block size 4096)

/data: 65536K total, 18464K used, 47072K available (block size 4096)

/cache: 65536K total, 1156K used, 64380K available (block size 4096)

As you can see the system partition has 0K space available. When a connect a non-rooted HTC Nexus One and do the same I get these values:

/dev: 108896K total, 0K used, 108896K available (block size 4096)

/sqlite_stmt_journals: 4096K total, 0K used, 4096K available (block size 4096)

/system: 148480K total, 116364K used, 32116K available (block size 4096)

/data: 200960K total, 22296K used, 178664K available (block size 4096)

/cache: 97280K total, 1852K used, 95428K available (block size 4096)

/sdcard: 3864064K total, 118496K used, 3745568K available (block size 32768)

Why does the system partition on the emulator have 0K free space from beginning, and what can I do to change that? Even if I make the partition write-able with mount/remount I get the same 0K values.

Any tips?

网友答案:

Found the answer :)

When starting the emulator you can specify the partition size by -partition-size x emulator_name.

done through the terminal that is. Example:

emulator -partition-size 125 @AVD1

OR

emulator -partition-size 125 -avd AVD1

Note that the size must be bigger than your current system partition size. For the Android4.0.3 emulator the default size is already 168 so set your new partition-size to something bigger like 256

网友答案:

I found the problem. The SDK_MANAGER folder was inside a NON-STANDARD characters directory in my D disk (D:/ასერ/?dwe + joan/SKD_MANAGER) and thats why it couldnt get the correct partition size. I moved **SDK_MANAGER* to D:/**SDK_MANAGER* and problem solved!

( so, who has the error messages like "Invalid system partition size" or "panick: could not open avd1", this post might help)

网友答案:

Nowadays, -partition-size changes the /system/data partition, but not the /system partition space.

If you want to install the full GApps, for example, you will need more space.

The general procedure to do so in Unix is documented at http://unix.stackexchange.com/questions/104790/how-to-setup-a-growable-loopback-device

In short:

  1. Make a copy of system.img so that you don't modify the original one in the SDK (cp system.img system-extended.img)
  2. Grow your system-extended.img to your desired size (e.g., truncate system-extended.img -s 2G)
  3. Resize the inner ext4 filesystem (resizefs system-extended.img)
  4. Use the new img file when calling the emulator via the -system <path/to/system-extended.img> parameter. The -writable-system parameter may also come in handy for you.
相关阅读:
Top