How to retrieve the android sdk version?

AndroidSdkVersion

Android Problem Overview


How can I get the current Android SDK version(1.5, 1.6, 2.0, etc.) programmatically?

Android Solutions


Solution 1 - Android

The String Build.VERSION.RELEASE will give you the user-visible version string (i.e 1.5, 1.6, 2.0), while Build.VERSION.SDK_INT will give you a value from Build.VERSION_CODES that would be better to use if you want to compare against it programatically.

Solution 2 - Android

  StringBuffer buf = new StringBuffer();

    buf.append("VERSION.RELEASE {"+Build.VERSION.RELEASE+"}");
    buf.append("\\nVERSION.INCREMENTAL {"+Build.VERSION.INCREMENTAL+"}");
    buf.append("\\nVERSION.SDK {"+Build.VERSION.SDK+"}");
    buf.append("\\nBOARD {"+Build.BOARD+"}");
    buf.append("\\nBRAND {"+Build.BRAND+"}");
    buf.append("\\nDEVICE {"+Build.DEVICE+"}");
    buf.append("\\nFINGERPRINT {"+Build.FINGERPRINT+"}");
    buf.append("\\nHOST {"+Build.HOST+"}");
    buf.append("\\nID {"+Build.ID+"}");

    Log.d("build",buf.toString()); 

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAruthaView Question on Stackoverflow
Solution 1 - AndroidErich DouglassView Answer on Stackoverflow
Solution 2 - AndroidRichaView Answer on Stackoverflow