androidandroid-emulator

specify screen size of avd in windows command line


When I start avd command line, by defaults it starts with a very big screen (more than 10in)and takes ages to load. But starting it from the SDK manager it works just fine with the screen size I want eg. 4in.

How do I specify this screen size from command line? I'm using the following command

emulator -avd SamsungGalaxy -partition-size 100

Solution

  • You can use the -scale <scale> or -dpi-device <dpi> options.

    The -scale option will scale the emulator window based on the factor (<scale> is number between 0.1 and 3; or a dpi value, i.e. 96dpi) that you specify as an argument to the option.

    The -dpi-device scales the resolution to match the screen size of a physical device. The default value is 165.

    For instance, for your specific case you may initialize the emulator as follows:

    emulator -avd SamsungGalaxy -scale 96dpi -dpi-device 160 -partition-size 100
    

    To check all the available emulator options, you should check this reference: Android Emulator.

    There's also a link that explains how to support multiple screens: Supporting Multiple Screens

    I hope this helps.