How to retrieve the android sdk version? [duplicate]

Solution 1:

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:

  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());