Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create android emulator(avd) with custom screen size and resolution from command line

I have to create an android emulator from command line in windows with below specifications,

screen size --> 4.7 inch
screen resolution --> 540x960 pixels
android version --> 4.4.2

i trying to create this emualtor from java.

i tried with

android -create avd -n <device_name> -t <apilevel> -c 300M -f

but it does create the emulator with screen size? what is the option and how can we create avd with custom screen size?

like image 982
AJJ Avatar asked May 13 '15 09:05

AJJ


People also ask

How do I change dpi in AVD?

When you hit the Start button in the AVD Manager then you get a popup window where you can select Scale display to real size . There you have to set the devices real screen size and your monitors dpi.


2 Answers

Android Official doc : Customize the device resolution or density

Use the create avd command to create a new AVD, specifying the --skin option with a value that references either a default skin name (such as "WVGA800") or a custom skin resolution (such as 240x432). Here's an example:

  1. android create avd -n <name> -t <targetID> --skin WVGA800 OR
  2. android create avd -n <name> -t <targetID> --skin 540x960

UPDATED
This tool is no longer supported. Instead use Android Studio to create AVDs

like image 52
Bharatesh Avatar answered Oct 04 '22 04:10

Bharatesh


I know, it's old, but maybe I can help others:

I am using linux, the directories may be different in windows or in custom installations.

  1. Create your standard VDI (./avdmanager create avd -n <name_vdi> -d <id_template>)
  2. Go to directory /home/<user_dir>/.android/avd/<name_vdi>
  3. Edit the file config.ini, search the following lines and change theirs values as you want:

hw.lcd.height=2340

hw.lcd.width=1080

  1. Save it and run your emulator again.

I hope I can help you or another person with the same issue.

like image 40
Davi Farias Avatar answered Oct 04 '22 03:10

Davi Farias