Setting up a Gradle project to compile native code

Android Studio is now the new officially supported Android IDE, in place of Eclipse. It comes with Gradle, which is the new official Android build system. Gradle introduces a Groovy-based specific language to define the project configuration easily. Although its support of the NDK is still preliminary, it keeps improving and is becoming more and more useable.

Let's now see how to create an Android Studio project with Gradle that compiles native code.

Note

The resulting project is provided with this book under the name Store_Gradle_Auto.

Get Android NDK Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.