Android - A way to get the current resolution size and DPI from the command line/terminal/adb?

the result and precise format of the dumpsys command depends on the hardware vendor (of graphics chipset/driver and handset itself) but you should be able to find that info in the adb shell dumpsys display output


In Android versions equipped with wm tool, you can use the commands:

adb shell wm size      # shows the real size and current size
adb shell wm density   # shows the real density and current density

(Click image to enlarge)

IMG:

I've tested successfully on stock Android 5.x and 6.x. Since wm tool comes with Android 4.3.x and 4.4.x as well, the solution may work on them as well.


If display service isn't available in dumpsys, you may look for line ro.sf.lcd_density= into /system/build.prop. To get it from phone:

adb pull /system/build.prop