There are gradel based configuration files and manifest of course that tells the IDE about the version of android for target device.
New things, methods, classes,packages are added in newer versions. That are not available in older versions. But the devices eventually are shipped with newer versions. Version 2.2 has been in use but now most devices are at least on version 4.2 and above.
There are compatibility packs too that allow some new features of newer versions, to be used in older versions.