 <p>As Ahmad says, you need to compile your code with API Level 14 in order to use the constant "ICE_CREAM_SANDWICH". The thing is that at compilation time those constants are changed into their respective values. That means that at runtime any device won't see the "ICE_CREAM_SANDWICH" constant but the value 14 (even if it is a device with Froyo 2.2 installed).</p> <p>In other words, in your code:</p> <pre><code>Integer version = Build.VERSION_CODES.ICE_CREAM_SANDWICH; </code></pre> <p>in the device:</p> <pre><code>Integer version = 14; </code></pre> <p>It is not exactly like that, but you get the idea.</p>