Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Android SDK version of a device from command line

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 there a way to get the sdk version of a connected device through android shell or adb?

There will be a computer to which several test devices is connected, and I was planning to write a script which will fetch the correct build for each of those from a build-server, install the different apks on their respective devices, launch them and collect log info, to be made available through some other program whose specifications are beside the point.

The point is that I need to know the sdk version each device is running to install the correct apk, and I was hoping I could get this through adb, but I can't seem to find a way to access it short of building a tiny app, compatible with all versions, whose sole purpose would be to output android.os.Build.VERSION.SDK or similar somewhere my script could read it.

like image 288
Arild Avatar asked Nov 09 '11 10:11

Arild


People also ask

How do I find Android SDK version?

Navigate to “Appearance & Behavior” > “System Settings” > “Android SDK” and now you can see the SDK versions that were installed in the “API Level” and “Name” columns (focus on “API Level”).

How do I find Android SDK on my computer?

3 in Windows), the SDK Manager is chosen by an icon on the big toolbar which has an incomprehensible glyph. If you can't find it, then instead you can select Tools-->Android-->SDK Manager. In the SDK Manager, select Appearance and Behavior-->System Settings-->Android SDK; and read the field "SDK Location".

What is Android SDK command-line tool?

The sdkmanager is a command line tool that allows you to view, install, update, and uninstall packages for the Android SDK. If you're using Android Studio, then you do not need to use this tool and you can instead manage your SDK packages from the IDE.


1 Answers

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
like image 82
Tim Avatar answered Oct 10 '22 02:10

Tim