Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the android emulator RAM size from the command line?

I want to edit or change the ram size while creating the android emulator from command line.

EX: While creating the emulator it's taking default ram size(Android SDK 4.0.3) 512 MB But I want to increase it to 768MB or decrease it to 256MB.

I want to change only Ram size. Because there is an option to change the Ram size.

 Do you wish to create a custom hardware profile [no] Yes

If you entered yes, we need to provide so many things.

like image 768
Srikanth Chilukuri Avatar asked Feb 17 '12 03:02

Srikanth Chilukuri


People also ask

How do I change the ram on my emulator?

Go to Tools->Android->AVD Manager , there's something like pencil to edit your AVD click on that, then in the pop-up window click Show Advanced Settings and there you can change the RAM size.

How do I increase the size of my emulator?

On Android StudioClick Edit Icon to edit the AVD. Click Show Advanced settings. Change the Internal Storage, Ram, SD Card size as necessary. Click Finish.

How much ram should I give the android emulator?

However, the heap size should not be less than 12 MB. o Depending on your computer specs, the recommended ram size is in the range between 512 MB – 1024 MB. Although you can give more ram to the emulator but an actual android device would normally have 512 MB – 1024 MB for ram only.


1 Answers

You need to find the config file for the AVD that you have created.

In my case, I'm running the AVD on Ubuntu, so this is where I found the config file.

~/.android/avd/emulator.avd/config.ini

"emulator" was the name I provided when I created the AVD, so the directory name will depend on what you provided.

The following is what is inside the config.ini file:

hw.lcd.density=240
skin.name=WVGA800
skin.path=platforms/android-8/skins/WVGA800
hw.cpu.arch=arm
abi.type=armeabi
vm.heapSize=64
hw.ramSize=1024
image.sysdir.1=platforms/android-8/images/

I increased my heap size from 24 to 64, and added the ram size parameter.

For the list of parameters you can add, refer to: Managing AVDs from the Command-line

like image 71
Shane Oliver Avatar answered Oct 20 '22 10:10

Shane Oliver