title: How to set the emulator pixel density from the command line?
body: <p>(Using android sdk 25.1.6)</p>
  
  <p>I am creating and opening Android emulator from the command line:</p>
  
  <pre><code>$&gt; android create avd -n my_device -t 9 --skin 1440x2560 --abi default/x86
  </code></pre>
  
  <p>How can I set its pixel density?</p>
  
  <p>I have tried the following approaches:</p>
  
  <ol>
  <li><p>After running the above command I answer "yes" to creating a hardware profile. When I'm asked what density to use I type 570 but it does not accept it (it asks me the same question again) and only accepts empty input (default).</p></li>
  <li><p>After creating the emulator, open ~/.android/avd/my_avd.ini and append:</p>
  
  <pre><code>hw.lcd.density=570
  </code></pre>
  
  <p>but this setting is ignored.</p></li>
  <li><p>add this flag when opening the emulator:</p>
  
  <pre><code>$&gt; emulator avd my_avd -dpi-device 570
  </code></pre>
  
  <p>but I get:</p>
  
  <pre><code>WARNING: The -dpi-device flag is obsolete and will be ignored
  </code></pre></li>
  </ol>
  
  <p>Any idea?</p>