简体   繁体   English

Android Studio 2.2或实验性Gradle插件是否支持NDK?

[英]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). Android Studio 2.2于2016年9月19日发布。此版本的主要公告之一是官方NDK支持,使用CMake(推荐)或ndk-build(旧版)。

I have a project that's currently using Experimental Gradle Plugin version 0.8.0, and it has been working great. 我有一个当前正在使用实验性Gradle插件0.8.0版的项目,它的运行非常好。 I don't have to worry about Android.mk or ndk-build, it is all handled for me behind the scenes. 我不必担心Android.mk或ndk-build,它们都在后台为我处理。

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? 随着Android Studio 2.2的出现和“官方NDK支持”的出现,我应该将本机库迁移到CMake还是保留原样? 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. 使用CMake和ndk-build迁移到NGrad支持的稳定Gradle,可以在两者之间进行选择。 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?). ndk-build选项适用于旧项目(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. 尽管实验性插件仅限于为Android构建,但CMake功能强大且成熟,可以满足各种需求并简化与现有本机库的集成。 So use wisely. 因此,明智地使用。

If it ain't broke don't fix it. 如果没有破裂,请不要修复。 The experimental gradle syntax isn't going away any time soon. 实验性gradle语法不会很快消失。

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. 对于任何新事物,我们建议使用cmake,因为它很可能会与开源库互操作(非Android特定的事物通常是cmake),但是如果您更喜欢其中的一种,那就去做吧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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