如何开始使用 Android Studio C++ 开发
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32150500/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get started with Android Studio C++ development
提问by proppy
I heard at Google I/O 15 that Android Studio has now C++ support, the official documentation for the NDKonly has instructions for Eclipse.
我在 Google I/O 15 上听说 Android Studio 现在有 C++ 支持,NDK的官方文档只有 Eclipse 的说明。
How does one get started with Android C++ development using Android Studio?
如何开始使用 Android Studio 进行 Android C++ 开发?
回答by proppy
There is detailed instructions on the Android NDK Previewsite.
Android NDK 预览站点上有详细说明。
The gist of it
它的要点
- DownloadAndroid Studio 1.3+
- Install the NDK bundle from Tools > Android > SDK Manager
- Import the hello-jn sample using File > Import Sample(Note: This sample is using the new
gradle-experimental
plugin) Click Run > Edit Configurations...and andd a new Android Nativeconfiguration
(source: android.com)Run and debug your application as usual
- 下载Android Studio 1.3+
- 从Tools > Android > SDK Manager安装 NDK 包
- 使用File > Import Sample导入 hello-jn 示例(注意:此示例使用的是新
gradle-experimental
插件) 单击Run > Edit Configurations...并添加一个新的Android Native配置 (来源:android.com)
像往常一样运行和调试您的应用程序
A few things to try from there:
从那里可以尝试一些事情:
- Generate JNI bindings for Native Java function.
- Put breakpoint in native code (with the current limitation that breakpoint on init/onCreate get skipped, should be already fixed in Android Studio 1.4 Preview)
- Give feedbackto the team
- Try and contribute to the new sample on GitHub
- Explore the new documentationand API reference.