Skip to content

Most visited

Recently visited


Native Development Kit

The Native Development Kit (NDK) APIs enable you to write an Android Things app purely in C/C++ or extend a Java-based Android Things app with C or C++ code. You can use these APIs to port existing drivers and apps written for other embedded platforms.

Getting started with the NDK

If you've never used the NDK, see the Android NDK Getting Started guide to download and install the NDK. The documentation also has detailed information on how to use the NDK.

Get the Android Things native library

First, download the Android Things NDK new project template from GitHub.

The native peripheral I/O APIs are available in the Android Things native library. You will need these APIs to communicate with sensors, actuators, and other peripherals using industry standard protocols and interfaces.

Copy the entire directory into the root directory of the Android Studio new project template. The directory structure looks like this:


You'll include the header files in the include/pio directory to compile your app and link the shared object for the appropriate application binary interface (ABI), for example, x86, when you package your app. The FindAndroidThings.cmake CMake module file is also available to help you configure new NDK projects to use the Android Things native library.

See the header files for the library in the GitHub repository for more information and documentation.

Packaging native code

Android Things apps are bundled with the system image and are read-only at runtime. This requires that binary assets like native shared libraries are read directly from the APK instead of being extracted at install time. Apps that include NDK code must set the extractNativeLibs attribute to false in their manifest file for proper compression, packaging, and alignment of the libraries within the APK:

<manifest ...>
    android:extractNativeLibs="false" ...>


Native PIO APIs

The native Peripheral I/O (PIO) APIs let you write C/C++ code to control GPIO, PWM, I2C, SPI and UART peripherals that access the same underlying peripheral service as the standard Peripheral I/O APIs.

Get started with the native PIO APIs.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)