-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Android NDK Setup
This page explains how to compile gameplay for Android devices.
Android NDK development works on Linux, MacOSX and Windows desktop environments.
Before you get started you will have to download the dependencies separately:
- Download and install the Android SDK.
- Make sure
<android-sdk-path>/tools
and<android-sdk-path>/platform-tools
are added to PATH.
- Download and install the Android NDK.
- Make sure
<android-ndk-path>
is added to PATH.
- Download and install Apache Ant.
- Make sure
<ant-path>/bin
is added the PATH.
- Run the SDK Manager to install SDK Platform for Android 4.1.2 (API 16)
- 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
- Change to the android directory for the sample you want to build:
cd samples/browser/android
- Run the following command:
ant debug
Make sure developer mode is enabled and USB debugging is turned on.
- Change directory to the sample you want to build, package and install:
cd samples/browser/android
- Install the app:
ant debug install
If 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)
Use 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