Getting Android SDK version of a device from command line

前端 未结 4 1251
抹茶落季
抹茶落季 2021-02-02 15:00

I\'m planning to build an automated system for deploying an Android build to various devices, in order to make development for multiple platforms a bit more comfortable. Is ther

相关标签:
4条回答
  • 2021-02-02 15:16

    I think you can by accessing the device with adb shell - change directories to position you at system and do a cat of build.prop. Here you will find for instance, ro.build.description=google_sdk-eng 2.2, ro.build.version.release=2.2 etc

    0 讨论(0)
  • 2021-02-02 15:19
    adb shell getprop ro.build.version.sdk
    

    Note @Tim: this works even on phones without grep support on all host OS :-). (i.e. on old phones where toolbox does not support grep you you need to have busybox on your phone).

    0 讨论(0)
  • 2021-02-02 15:20

    you can use this command:

    adb shell grep ro.build.version.sdk= system/build.prop
    

    It will output something like this:

    ro.build.version.sdk=10
    
    0 讨论(0)
  • 2021-02-02 15:21

    I also discovered a way to get the exact version of Android e.g. 4.2.2 based on the following web article http://xayon.net/looking-for-android-version-with-adb/ You need to be using a unix-like operating system - Linux and Mac OSX are fine, and windows users can use cygwin or equivalent.

    At a command line:

    echo version=$(adb shell getprop |awk -F":" '/build.version.release/ { print $2 }')|tr -d '[]'

    Here is the result for my Nexus 4:

    version= 4.2.2

    0 讨论(0)
提交回复
热议问题