Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Android NDK Setup
Android NDK development works on Windows, MacOS and Linux development environments.
Install External Dependencies
Before you get started you will have to download the dependencies separately:
Install the Android SDK
- Download and install the Android SDK.
- Make sure
<android-sdk-path>/platform-toolsare added to PATH.
Install the Android NDK
Install Apache Ant
Install Android SDK Package (API 16)
- Run the SDK Manager to install SDK Platform for Android 4.1.2 (API 16)
Configure Build Target
- Run the following command to list the available build targets and note the target id for 'android-16'
android list targets
- This will produce a list like this:
Available Android targets: ---------- id: 1 or "android-16" Name: Android 4.1.2 API level: 16 Revision: 1 ---------- id: 2 or "android-21" Name: Android 5.0 API level: 21 Revision: 1 ...
- Run the following command to generate the property files for ant for the selected target id: 1 (android-16):
android update project -t 1 -p . -s
Build Library and Samples
- Change to the android directory for the sample you want to build:
- Run the following command:
Package and Install
Make sure developer mode is enabled and USB debugging is turned on.
- Change directory to the sample you want to build, package and install:
- Install the app:
ant debug install
Device not detected
ant debug install does not work, ensure your device is being detected properly by running
adb devices. If no devices are reported, try downloading the correct USB drivers from you phone manufacturer's website. (OEM Drivers)
logcat to capture the log file from the device.
adb logcat -d > logcat.txt
If your program crashed then the log file will contain the stack trace without symbols. Use
ndk-stack to make the stack trace readable.
-sym points to the directory that contains the symbols while
-dump points to the log file.
ndk-stack -sym C:\Git\gaming\GamePlay\samples\browser\android\obj\local\armeabi -dump d:\logcat.txt