1

I'm new to Android system, and trying to port some legacy C++ work to Android 5.1 system. I'm a bit confused on version number which I met each day.

I search the StackOverflow, and found below to link are helpful, but still a bit confusion.

There's direct mapping between Android and API level. See this good link: Android: API level VS. Android version

However, when I decide to pick up NDK version to build my native application. I found I was confused. Even this link Relation between the NDK version and the Android version give some information on version relation, but, it still seems too much choice for me. Take NDK-r10 as example, in its platform directory, there are list of different version toolchain.

2018-07-10  12:32    <DIR>          android-12
2018-07-10  12:31    <DIR>          android-13
2018-07-10  12:31    <DIR>          android-14
2018-07-10  12:32    <DIR>          android-15
2018-07-10  12:31    <DIR>          android-16
2018-07-10  12:32    <DIR>          android-17
2018-07-10  12:31    <DIR>          android-18
2018-07-10  12:31    <DIR>          android-19
2018-07-10  12:33    <DIR>          android-21
2018-07-10  12:33    <DIR>          android-3
2018-07-10  12:31    <DIR>          android-4
2018-07-10  12:30    <DIR>          android-5
2018-07-10  12:33    <DIR>          android-8
2018-07-10  12:33    <DIR>          android-9

Does this platform version have relationship with API level? Is there some risk I pick up the latest NDK and latest platform version to build application for a older Android system? I was confused on that.

Could someone point out the right way to follow ?

Thanks very much!

Jeff

Poor
  • 51
  • 5
  • 1
    From [the NDK documentation](https://developer.android.com/ndk/guides/application_mk): _"This [is] the minimum Android platform version you want to support. For example, a value of **android-15** specifies that your library uses APIs that are not available below Android 4.0.3 (API level 15) and can't be used on devices running a lower platform version."_ – Michael Jul 10 '18 at 15:53
  • 3
    As for which NDK version you should use, this is what one of the NDK maintainers has to say: _"The NDK version and the Android version you are targeting are orthogonal concepts. You should always be using the latest NDK for the best behavior (possibly N-1 if there's a bug in the latest stable, but that won't be the average case)."_ So, put simply, use the latest NDK and a platform version <= your minSdkVersion. – Michael Jul 10 '18 at 15:58
  • Couldn't have said it better myself ;) – Dan Albert Jul 10 '18 at 17:01
  • @Michael why we choose a platform version <= your minSdkVersion ? typo? – Poor Jul 11 '18 at 03:30
  • 1
    @Poor: No, not a typo. Consider the quote in my first comment, i.e. that a platform version of X specifies that your library can only be used on devices running API level X or later. So at most, X should be the same as your minSdkVersion. But you can set it to something _lower_ than that, if you want to. – Michael Jul 11 '18 at 05:55

0 Answers0