When installing the SDK i read something about 97% of phones support Android 2.1
My question is should i, when opening a new project choose to compile it to Android 2.1?
Will apps written for 2.1 work in newer version?
Will the opposite work? if i develop to 4.0.3, will it work in older?
Thanks,
Eric
What you specify as your build target (“choose to compile it to”) has no direct effect on what versions of Android can run your application.
For any reasonable interpretation of the word “for”, yes.
As with Agarwal’s answer, this depends on what you mean by “to”.
For example, suppose that you want to use
CalendarContract. This class was added in API Level 14 (a.k.a., Android 4.0). So long as you only useCalendarContracton Android 4.0+ devices, you will be fine. If, however, you try to useCalendarContracton an older device, you will crash, because that class will not exist in the firmware.Hence, you can conditionally use newer APIs, so long as you ensure that you only use those newer APIs on devices running a newer version of Android. Typically, this is done via a version guard block, something like: