檢視裝置資訊
-
- 型号
- 電池狀況
- 螢幕分辨率
- 螢幕密度
- 顯示屏參數
- android_id
- IMEI
- Android 系統版本
- IP 位址
- Mac 位址
- CPU 資訊
- 記憶體資訊
- 更多硬體與系統屬性
型号
adb shell getprop ro.product.model
我這使用的是錘子手機做測試:

電池狀況
adb shell dumpsys battery
其中
scale
代表最大電量,
level
代表目前電量。上面的輸出表示還剩下
90%
的電量。
螢幕分辨率
adb shell wm size
螢幕密度
adb shell wm density
該裝置螢幕密度為
480dpi
。
顯示屏參數
adb shell dumpsys window displays
其中
mDisplayId
為 顯示屏編号,
init
是
初始分辨率
和
螢幕密度
,app 的高度與 init 一緻,表示螢幕底部沒有虛拟按鍵。
android_id
adb shell settings get secure android_id
IMEI
在
Android 4.4 及以下版本
可通過如下指令擷取
IMEI
:
adb shell dumpsys iphonesubinfo
輸出示例:
Phone Subscriber Info:
Phone Type = GSM
Device ID = 860955027785041
其中的
Device ID
就是
IMEI
。
而在
Android 5.0 及以上
版本裡這個指令輸出為空,得通過其它方式擷取了(
需要 root 權限
):
adb shell
su
service call iphonesubinfo 1
輸出示例:
Result: Parcel(
0x00000000: 00000000 0000000f 00360038 00390030 '........8.6.0.9.'
0x00000010: 00350035 00320030 00370037 00350038 '5.5.0.2.7.7.8.5.'
0x00000020: 00340030 00000031 '0.4.1... ')
把裡面的有效内容提取出來就是
IMEI
了,比如這裡的是
860955027785041
。
Android 系統版本
adb shell getprop ro.build.version.release
IP 位址
adb shell ifconfig | grep Mask
windows 需要加引号 "ifconfig | grep Mask"
Mac 位址
adb shell cat /sys/class/net/wlan0/address
CPU 資訊
adb shell cat /proc/cpuinfo
記憶體資訊
adb shell cat /proc/meminfo
其中,
MemTotal
就是裝置的總記憶體,
MemFree
是目前空閑記憶體。
更多硬體與系統屬性
裝置的更多硬體與系統屬性可以通過如下指令檢視:
adb shell cat /system/build.prop
這會輸出很多資訊,包括前面幾個小節提到的「型号」和「Android 系統版本」等。
輸出裡還包括一些其它有用的資訊,它們也可通過 adb shell getprop <屬性名> 指令單獨檢視,列舉一部分屬性如下:
屬性名 | 含義 |
---|---|
ro.build.version.sdk | SDK 版本 |
ro.build.version.release | Android 系統版本 |
ro.build.version.security_patch | Android 安全更新檔程式級别 |
ro.product.model | 型号 |
ro.product.brand | 品牌 |
ro.product.name | 裝置名 |
ro.product.board | 處理器型号 |
ro.product.cpu.abilist | CPU 支援的 abi 清單[節注一] |
persist.sys.isUsbOtgEnabled | 是否支援 OTG |
dalvik.vm.heapsize | 每個應用程式的記憶體上限 |
ro.sf.lcd_density | 螢幕密度 |