如何使用NDK?从“hello world"应用程序开始 [英] How to use NDK? Starting with 'hello world' app

查看:21
本文介绍了如何使用NDK?从“hello world"应用程序开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望看到一个用 C/C++ 编写但可以在 Android 上运行的Hello world"程序.

I would like to see a 'Hello world' program written in C/C++ but made to run on Android.

我知道这可以通过使用 NDK 和 JNI 调用来实现.但无法使其工作.没有在线指南有帮助.

I know this is possible by using NDK and JNI calls. But not able to make it work. No guides online are helpful.

需要知道才能开始.

我正在 Windows 7 机器上进行开发,并且为了方便也使用 Eclipse.

I am developing on Windows 7 machine and also using Eclipse for ease.

Android安装路径:C:Program FilesAndroidandroid-sdk-windows和 NDK 我已提取到:C:Program FilesAndroidandroid-ndk-r5

Android installation path: C:Program FilesAndroidandroid-sdk-windows and NDK I have extracted to: C:Program FilesAndroidandroid-ndk-r5

  1. 如何将 NDK 导入 Eclipse?
  2. 如何在 Android 中使用 C/C++?

如果我能在运行一个简单的hello world"时获得帮助,我可以用 C++ 设计我的大部分敏感代码.

If I could get help running a simple 'hello world' I can design most of my sensitive code with C++.

推荐答案

android-ndk-r5 文件夹中有示例 + 有一个很好的分步教程:

There are samples in the android-ndk-r5 folder + there is a nice step-by-step tutorial:

https://developer.android.com/ndk/samples/index.html

没有借口,伙计.您只需阅读(查看探索 hello-jni 示例部分).

No excuses, dude. You just have to read (take a look at the Exploring the hello-jni Sample section).

这篇关于如何使用NDK?从“hello world"应用程序开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆