How to get the Android device screen size from the adb command line?

user954469 picture user954469 · Sep 23, 2011 · Viewed 88.8k times · Source

I need a way to detect device screen size and density with adb. If there is no solution, where can I get the complete list of all existing android device with their screen size and density ?

Answer

Albert-Jan Verhees picture Albert-Jan Verhees · Dec 10, 2014

You can also access the WindowManager through ADB:

$ adb shell wm
usage: wm [subcommand] [options]
       wm size [reset|WxH]
       wm density [reset|DENSITY]
       wm overscan [reset|LEFT,TOP,RIGHT,BOTTOM]

To get the screen resolution:

$ adb shell wm size
Physical size: 2880x1600

To get the screen the density:

$ adb shell wm density
Physical density: 320

You can also override the density by adding the new density:

$ adb shell wm density 160