Search code examples
androidapisdklibgdx

In libGDX, can I target lower API level, than the framework requires?


I've downloaded the latest version of libGDX framework, which is meant for API level 20. Now, I'd like to target API level 19, since it's market share is HUGE, but the framework's developers "strongly discourage" using older versions. I could create the project using API level 20 SDK, then change the SDK when I import it to Android Studio, but I have no idea how it'll work out. Is it going to work, or I must use an older version to reach API level 20? (Maybe alternatives?)

The documentation wasn't too helpful, and I haven't seen anyone else having a problem like this, so I might have missed something.


Solution

  • Typically, you always want to target the most recent API version available, and set your minSdkVersion as low as you are willing to put the effort into supporting.

    However, LibGDX is only officially tested up to level 20, so this is the safe target to use. You only need to go higher than 20 if there are some new API features you want to use. If you do that, make sure you test on a device with that API or later, since LibGDX hasn't officially started supporting it.

    If you target 20, it will still work fine on later versions.

    When Android gets API or behavior changes that have the potential to break old apps, the change only takes effect on apps that target the new API or higher. So all the old apps sitting in the store that haven't been updated will not be affected by the new API, because they don't target the new API.

    I release LibGDX apps that target 20 and go to min version 9. These apps are installable and run fine on any device running Gingerbread or higher. I always compile with the latest SDK because I don't want to bother with keeping multiple SDK versions installed.