NDK and Target API Level

31 views
Skip to first unread message

Mathew Upchurch

unread,
Nov 3, 2022, 2:50:35 PM11/3/22
to android-ndk
Can someone point me to some documentation or a good explanation of api target levels in regards to the NDK.  There seems to be a misunderstanding on what it actually means.  Should our target api level for an so built against the ndk be the min api level we define in the gradle script?  There seems to be some thought that if we link to target that we will not be supporting lower level devices.  For example if we target api level 33 (android 13)..  will we encounter issues with api level 24 (which is our min spec - Android 7)?

mic _

unread,
Nov 3, 2022, 3:36:12 PM11/3/22
to andro...@googlegroups.com

On Thu, Nov 3, 2022 at 7:50 PM 'Mathew Upchurch' via android-ndk <andro...@googlegroups.com> wrote:
Can someone point me to some documentation or a good explanation of api target levels in regards to the NDK.  There seems to be a misunderstanding on what it actually means.  Should our target api level for an so built against the ndk be the min api level we define in the gradle script?  There seems to be some thought that if we link to target that we will not be supporting lower level devices.  For example if we target api level 33 (android 13)..  will we encounter issues with api level 24 (which is our min spec - Android 7)?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/8c205706-429c-45fc-8ae9-93af3a1d07bdn%40googlegroups.com.

Dan Albert

unread,
Nov 3, 2022, 4:13:19 PM11/3/22
to andro...@googlegroups.com
https://developer.android.com/ndk/guides/sdk-versions explains what they all mean. apilevels.com is also a great resource. You might be confused because some NDK focused docs say things like "build target", which is actually minSdkVersion and not targetSdkVersion (anything we've written recently should always use the manifest field names like that, because everything else is hopelessly confusing).

Your minSdkVersion is just that: your app will not work on anything older than that version. Pick the oldest version of Android you care to support (but check meta/platforms.json in the NDK, because the NDK has its own minimum, which is 19 as of r25 but will be 21 in r26). apilevels.com and the New Project Wizard in Android Studio will both show you information about user distribution. Pick a balance between market share and maintenance burden (the older the device, the more bugs it has, usually). After your app gains users, Play will give you user metrics specific to your app that can help you tune that.

targetSdkVersion is effectively a bug compatibility flag (behavior changes are often gated on targetSdkVersion). Set it as high as you're able. Play enforces a minimum, and that minimum rises annually. A new app created today should use 33.

The others are not really relevant to NDK development.

On Thu, Nov 3, 2022 at 11:50 AM 'Mathew Upchurch' via android-ndk <andro...@googlegroups.com> wrote:
Can someone point me to some documentation or a good explanation of api target levels in regards to the NDK.  There seems to be a misunderstanding on what it actually means.  Should our target api level for an so built against the ndk be the min api level we define in the gradle script?  There seems to be some thought that if we link to target that we will not be supporting lower level devices.  For example if we target api level 33 (android 13)..  will we encounter issues with api level 24 (which is our min spec - Android 7)?

--

Dan Albert

unread,
Nov 3, 2022, 4:40:02 PM11/3/22
to andro...@googlegroups.com
(I've send a change updating the content of my first link to include a lot of what I just said that wasn't already in the doc, specifically the bits about "okay, but how show I actually choose these values?")
Reply all
Reply to author
Forward
0 new messages