Search code examples
androidandroid-api-levels

Is it okay to always use a high API level?


I am a beginner.

Whenever I write code, I get confused.

It is when the compiler issues warnings about the API level (SDK version), either in XML code or in Java code.

In my gradle, the current minSdkVersion is 19. Originally it was around 16.

When I first wrote the code, I frequently encountered API level issues. And it seems that the minimum version is too low, so I uploaded the version.

Nevertheless, when writing code, there are many times when a higher API level is requested.

So I am confused.

Maintaining the current version (level 19) Should we handle issues according to the API level? (I don't know how to set it up. Especially in xml)

Or should I just upgrade the version to level 21? (Currently, the api level issue encountered in xml is 21)

What level of level is better to set the minimum level?

Since I am a beginner, I am not sure how much to set the api version.


Solution

  • I'm not going to tell you which version you should use, instead, I'll explain that certain code and features are only available on newer devices (higher API levels). If you plan to maintain older devices, you'll have to plan around this and not use those features which aren't available at lower versions.

    Sure, android does have support for this, you can check API levels in code or make use of specific folders to target specific Api levels but, the older the api you support, the more devices your app will run on and that comes at the cost of having to maintain those olders devices too.

    Your choice really, either update your minimum version to support older devices and maintain their code, or increase it, which will remove support to older devices.

    if you're going to set it to 21, will this make development easier ? Probably, as more functions will become available to you. Your app won't be usable to people who are making use of android below api 21, but realistically 90% of users will still be able to run your app.


    Personal answer, I don't develop for anything under api 23 unless someone requests it


    enter image description here

    This is the distribution graph*, showing how many users are available when making use of a specific api version

    I'm not sure how updated this graph is, but you can find it in android studio when making a new project