Member-only story
Getting Started with NDK in Android
Native Development Kit (NDK) is a set of tools that allows using c or c++ code in your android application. It provides the native platform libraries that enables managing native libraries, gives access to physical device components and super useful for cases like developing games or reuse any c/c++ libraries in your app. This post will be helpful for anyone looking to get started with NDK in your android app, and some very basic functions for interacting with native c code.
- Start a new Android Studio project with type Native C++
- Configure your project to use Kotlin/Java & ensure “Use androidx.* artifacts” is checked.
- In the “Customize C++ Support” Dialog, select “C++11” for “C++ Standard”. This ensures the appropriate “cppFlags” are setup in your project’s build.gradle file.
- After finish, Android Studio creates your project with the Android and the cpp files.
You might come across this error the first time:
NDK not configured. Download it with SDK Manager
Go to SDK Manager -> SDK Tools -> select NDK (Side By side) — install. In your App/build.gradle , add the…