Search code examples
androidandroid-api-levels

Android Target API - How to test how low I can go?


I am just about to release an application (To friends and family at least). My project API levels are:

minSdkVersion 19
targetSdkVersion 23

I hear this question a lot when people are about to start their endeavour;

What API level should I target?

I am obviously way past that - Using 19 as minSdkVersion will work for most of my target audience.

What I am wondering is this; I am unsure if the code I have written actually needs SDK level 19. I am thinking I could possibly reach a larger audience without modifying anything other than minSdkVersion.

I am however unsure about how to test this. Can I simply try lowering it until Gradle throws build errors? Is it guaranteed to work, if the app builds? I can't seem to find this information anywhere.


Solution

  • Well, that completely depends upon what features are you planning to have in your app. What are the bare features that you must have (make an exhaustive list) to make your app do stuff that it is supposed to do.

    Every SDK version is released with a few additional features. Some of them come with a support library, which make the feature work even in some early API levels.

    How to test how low I can go?

    Well, atleast you cannot go low beyond what all your dependencies allow you to go. Suppose you are using a few libraries that require minimum 11, 14 and 17, then you cannot go below 17. That's one cap. And here you need to take care of the support libraries. For example, fragments were released with 11, but using support libraries, you can use it in gingerbread and froyo. So, cap-value lowered further!

    And how do I get this cap-value?

    Ideally, before starting the development. Write down what features you need and what libraries/classes you will need to implement them. Find the minimum api level that supports them. And there you have it. Now, since you're already done with the app and you don't really plan to release it for as many devices as you can, keep lowering the gradle is the best time-efficient thing you can do.