How do I know what android ndk version I'm running in
In the gui you can go to Settings->About Phone->Firmware Version and get 2.1 (or whatever). How do I do it 开发者_StackOverflow中文版from command line (or for a native application that needs to do it in run time ) ?
The NDK doesn't run on the phone, it's just a set of tools that let you build native libraries that will run on Android devices. As such, there is no version checking.
The only hard requirement is that you use Android 1.5 or above:
The native libraries created by the Android NDK can only be used on devices running the Android 1.5 platform version or later.
However, if you want to use particular parts of the OpenGL ES APIs, you need to make sure your app is running on a certain version of the Android OS — but this is done as normal via the AndroidManifest.xml file.
See http://developer.android.com/sdk/ndk/index.html#requirements for more details.
Actually, that is a good question. If I want to enable compilations on both versions, I need to know what version of NDK I'm using, because the code tree structure is different between the 2 of them. I found that there is some kind of a variable they are using inside one of their internal makefiles, but it is the same for both versions.
I hope google will add a way to distinguish between the versions in the future.
精彩评论