CMake and ndk-build support in Android Studio 2.2

Posted by Kathryn Shih, Android Product Manager

In addition to supporting the experimental Gradle plugin, href="">Android
Studio 2.2 enables you to build C/C++ components of Android projects using
CMake and ndk-build.

The Android Studio team plans to continue to support the experimental Gradle plugin.
This will eventually replace the current Gradle plugin, providing additional
tightly-integrated benefits to C/C++ developers such as smarter dependency
management. So if you're interested in someday having the smartest possible
interface between your IDE and your build system, you shouldn't ignore the
experimental plugin.

CMake and ndk-build are useful alternatives to Gradle in several cases:

  • Projects that are already using CMake or ndk-build, such as legacy Eclipse
    ndk projects
  • Projects that are unable to assume the risk of using an experimental plugin
    for their C/C++ builds
  • Projects that will share a C/C++ build system across multiple platforms
  • C/C++ projects that need to use advanced features currently unavailable in
    experimental Gradle such as NEON support

For new projects, we recommend using CMake or experimental Gradle. For new
Android projects with limited C++, we recommend trying the experimental Gradle
plugin. For projects with substantial amounts of C++, or where you want the
maximally stable build configuration, we recommend using a CMake build. Android
Studio intends CMake to be a permanently supported solution.

While we think that there are substantial advantages to having a single build
system able to handle all parts of an Android application, stabilizing the
experimental plugin is not an option for us because it relies on Gradle APIs
that are still a work in progress. Until the Gradle APIs are stabilized, the
experimental plugin will keep changing, particularly in its Domain Specific
Language, and will be strictly tied to a very specific version of Gradle itself.

Note that the the old, undocumented ndkCompile integration is deprecated. If you
are using it, you need to move away from it as we'll remove it completely in the
near future. We recommend migrating to gradle+cmake via our href="">migration

Migrating from Eclipse to Android Studio

no longer support the Eclipse ADT. To get started migrating, href="">download and install
Android Studio. For most projects, migration is as simple as importing your
existing Eclipse ADT projects in Android Studio with the File → New→
Import Project
menu option. For more details on the migration process,
check out the href="">migration

Feedback and Open Source Contributions

We're dedicated to making Android Studio the best possible integrated
development environment for building Android apps, so if there are missing
features or other challenges preventing you from using Android Studio, href="">we want to hear about it [href="">please take our survey]. You
can also file bugs or feature
directly with the team, and let us know via our href="">Twitter or href="">Google+ accounts.

Android Studio is an open source
project, available to all at no cost. Check out our href="">Open Source project page if
you're interested in contributing or learning more.

Related Posts

Subscribe Our Newsletter