What are NDK native APIs?
The Android NDK provides a set of native APIs that allow you to write performance-critical portions of your Android apps in C and C++. These APIs include both standard C/C++ libraries and Android-specific functionality.Available API categories
The NDK includes the following types of native APIs:Standard C/C++ libraries
POSIX-compatible APIs provided by Bionic, Android’s C library
Android-specific APIs
Native activity, asset management, logging, and more
Graphics and media
OpenGL ES, Vulkan, Media NDK, Camera2 NDK
Neural Networks
NNAPI for hardware-accelerated machine learning
API levels and compatibility
NDK APIs are tied to Android API levels. Each API level corresponds to an Android platform release and determines which APIs are available.Understanding API levels
The minimum API level your app supports. Determines which APIs you can safely use.
The API level your app is designed for. Affects behavior changes and optimizations.
The API level used to compile your app. Should be the latest available version.
API availability by Android version
| Android Version | API Level | Notable Native APIs |
|---|---|---|
| Android 15 | 35 | Latest Vulkan extensions, Camera improvements |
| Android 14 | 34 | Enhanced NNAPI, Media codecs |
| Android 13 | 33 | Vulkan 1.3, Java interop improvements |
| Android 12 | 31-32 | Game Activity, Performance Hint API |
| Android 11 | 30 | Native File Descriptor API, ImageDecoder |
| Android 10 | 29 | Neural Networks API 1.2, Vulkan 1.1 |
| Android 9 | 28 | Neural Networks API, ImageDecoder |
| Android 8.1 | 27 | Shared memory API, Hardware buffers |
| Android 8.0 | 26 | AAudio, Choreographer, Vulkan 1.0 |
Stability guarantees
The NDK provides different stability guarantees for different types of APIs:Stable APIs
These APIs are guaranteed to be available and maintain backward compatibility across Android versions. Safe to use in production apps.
- Standard C library (libc)
- Math library (libm)
- C++ standard library (libc++)
- OpenGL ES
- Android-specific libraries (libandroid, liblog, etc.)
Preview and experimental APIs
When to use experimental APIs
When to use experimental APIs
Experimental APIs are useful for:
- Testing new features before they become stable
- Providing feedback to the Android team
- Prototyping and proof-of-concept work
Finding API documentation
Official NDK API documentation is available at:NDK API Reference
Complete reference for all Android-specific native APIs
Code example: Checking API level at runtime
Code example: Conditional compilation
Best practices
Always check API level before using version-specific APIs
Always check API level before using version-specific APIs
Use
android_get_device_api_level() at runtime or __ANDROID_API__ at compile time to ensure APIs are available before calling them.Target the latest API level when possible
Target the latest API level when possible
Newer API levels provide better performance, security, and features. Update your
targetSdkVersion regularly.Provide fallbacks for older Android versions
Provide fallbacks for older Android versions
If you need to support older devices, implement alternative code paths for missing APIs.
Use NDK's built-in feature detection
Use NDK's built-in feature detection
Many NDK libraries provide their own feature detection mechanisms. Use them instead of manual API level checks when available.
Next steps
Android-specific APIs
Learn about NativeActivity, Asset Manager, logging, and other Android-specific APIs
Bionic status
Check POSIX compliance and available functions by API level
Platform APIs
Understand platform API availability and compatibility
NDK Guides
Official NDK development guides