androidsdkandroid-versionandroid-api-levels

If I make an app at API level 21 (5.0), will it work with newer version of android?


I just started to use android 2 weeks ago.

I have successfully made my first app with API level 21 (5.1 Lollipop). My phone's android is also 5.1 Lollipop.

I wonder if my app will work with all newer version of android, such as 6.0 marshmallow or 7.0 nougat? Or do I need to provide updates?

Thanks.


Solution

  • Yes it will work on newer versions as long as you do not have maxSdkVersion set to 21

    In your application manifest, you will find up to three attributes:

    android:minSdkVersion

    android:targetSdkVersion

    android:maxSdkVersion

    If your max is set to 21 then it will not work with newer versions. You might not even have a max set.

    You likely have your target set at 21 or your min set at 21, or both...

    You can learn more about <uses-sdk> here

    One thing to note : 4.4 kitkat still has 17% of the API distribution so you might want to set your minSdkVersion to 19. You can find a weekly updated distribution chart here