Introduction to Android NDK
The Android Native Development Kit (NDK) allows you to include native code in your Android application packages, compiled as JNI shared libraries. This enables you to leverage C and C++ code for performance-critical portions of your app.What is the Android NDK?
The NDK is a toolset that allows you to implement parts of your Android app using native-code languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages. Native code is compiled into JNI (Java Native Interface) shared libraries that are packaged with your Android application. Your Java or Kotlin code can then call functions in your native libraries through the JNI framework.Key features
High performance
Execute computationally intensive operations with native code for maximum performance
Code reuse
Leverage existing C/C++ libraries and codebases across platforms
Low-level access
Access Android and device hardware features at a lower level
Multiple build systems
Support for ndk-build and CMake build systems out of the box
Use cases
The NDK is particularly useful for:Performance-critical applications
Native code can provide significant performance improvements for:- High-performance audio - Real-time audio processing with low latency
- Graphics rendering - Vulkan-based graphics and game engines
- Neural networks - Machine learning inference with optimized computation
- Signal processing - Image, video, and audio processing algorithms
Cross-platform development
Reuse existing C/C++ libraries across multiple platforms:- Port desktop applications to Android
- Share business logic between iOS and Android
- Integrate third-party native libraries
Most apps do not need the NDK. If you’re writing a typical Android app with standard UI and business logic, you should use Java or Kotlin exclusively.
Getting started
Installation
Install the NDK through Android Studio or as a standalone download
Quick start
Build your first native Android application in minutes
Build systems
Learn about ndk-build and CMake build configurations
API reference
Explore the complete NDK API documentation
Build system support
Android Studio supports both ndk-build and CMake build systems out of the box:- ndk-build - The NDK’s traditional build system using Android.mk files
- CMake - Industry-standard build system with CMakeLists.txt configuration
Key resources
Documentation
- NDK Guides - Comprehensive guides for building and debugging
- NDK API Reference - Complete API documentation for Android-specific native APIs
- NDK Roadmap - Future development plans
Community and support
- Android NDK Google Group - Community discussions
- GitHub Issues - Bug reports and feature requests
- Release Calendar - Upcoming releases and downloads
Understanding the C library (bionic)
Android uses its own C library called “bionic”. Important resources:- API availability - Different APIs are available in different Android API levels
- Dynamic linker changes - Critical information if you encounter issues loading .so files
- ABI considerations - Special considerations for 32-bit vs 64-bit code
Always check the Android bionic status to understand which APIs are available in your target Android versions.