My project supports API8+. In one method I use an ArrayDeque, which is only available in API9. Therefore it is annotated with “@TargetApi(9)”, plus I check the Build.VERSION.SDK_INT before using it.
Now, obviously I have an import java.util.ArrayDeque which throws an error when built against API8. Will it be fine once I built it against the higher targeted API version, but run on a API8-device??
Yes, assuming that you are correct about this:
You would have problems running this on an API Level 4 or lower device, perhaps, as this sort of backwards compatibility was more annoying way back then. But API Level 8 should be fine, so long as you never use this class on devices older than API Level 9.