94

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

Lii
  • 10,777
  • 7
  • 58
  • 79
kiruwka
  • 8,932
  • 3
  • 29
  • 41

3 Answers3

241

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
  • 31,494
  • 15
  • 84
  • 93
  • 1
    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
16

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
  • 3,181
  • 24
  • 32
Don Chakkappan
  • 7,157
  • 5
  • 43
  • 57
10

For all properties:

adb shell getprop
com2ghz
  • 2,576
  • 3
  • 13
  • 24