简体   繁体   中英

Android Studio 2.2 or Experimental Gradle Plugin for NDK Support?

Android Studio 2.2 was release on Sept. 19th, 2016. One of the major announcements in this release was official NDK support, using either CMake (recommended) or ndk-build (legacy).

I have a project that's currently using Experimental Gradle Plugin version 0.8.0, and it has been working great. I don't have to worry about Android.mk or ndk-build, it is all handled for me behind the scenes.

With the advent of Android Studio 2.2 and "official NDK support", should I migrate my native library to CMake, or leave it as is? While steps for migration are mentioned, the documentation doesn't indicate which approach is the way of the future.

Migrate to Stable Gradle for NDK Support using CMake and ndk-build gives a guideline to choose in between. In one word, it really depends on the number of platforms your native code needs to support. The ndk-build option is for legacy projects (Eclipse?). While the experimental plugin is quite limited to build for the Android, CMake is powerful and mature to meet diverse demands and ease the integration with existing native libraries. So use wisely.

If it ain't broke don't fix it. The experimental gradle syntax isn't going away any time soon.

For anything new, we recommend cmake since it's likely going to interop with open source libraries (non-Android specific things are often cmake), but if you prefer one over the others, go for it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM