110

Can one use adb or adb shell commands to get attached emulator/device OS info, i.e. API version?

Lii
  • 11,553
  • 8
  • 64
  • 88
kiruwka
  • 9,250
  • 4
  • 30
  • 41

3 Answers3

279

To get Android version you can use:

adb shell getprop ro.build.version.release 

to get API level:

adb shell getprop ro.build.version.sdk 

You can see all available properties with this command:

adb shell getprop
Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94
  • 2
    If you have more devices attached to your machine, you will not be able to use this command by default. You need to provide ANDROID_SERIAL environment variable which identifies your device ID. This is an example: adb devices (you will get attached device IDs) ANDROID_SERIAL=DEVICE_ID adb shell getprop ro.build.version.release – Bakir Jusufbegovic Apr 21 '16 at 12:55
  • 4
    If you have several devices connected, specify `-s ID` where ID is the device's ID from `adb devices`. For example `adb -s 1234 shell getprop ro.build.version.release ` – Ohad Schneider Jan 11 '17 at 16:14
19

I know , you already got the correct solution , & here is my solution only for additional information.

You will get every details by cat ing the /system/build.prop file like

adb shell cat /system/build.prop

Here is collection of adb commands

SebMa
  • 4,037
  • 29
  • 39
Don Chakkappan
  • 7,397
  • 5
  • 44
  • 59
13

For all properties:

adb shell getprop
com2ghz
  • 2,706
  • 3
  • 16
  • 27