如何使用 eclipse 安装和构建 NDK?
我使用的是 ubuntu 10.10 版本,我曾经使用 eclipse 开发 Android 应用程序。现在我需要使用 NDK 来加载本机库。所以有人可以帮助我安装和构建 NDK 最新版本吗?
提前致谢。
I am using ubuntu 10.10 version where i used to develop android applications using eclipse. Now i need to use NDK with it to load native libraries.So can any one please help me here to install and build NDK latest version.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我按照 Santhosh_pulliman 提到的链接中给出的步骤进行操作,并得到了输出。这可能对你有帮助。
步骤1:在eclipse中安装C/C++支持
这将使您能够在eclipse中编写c语言程序。如果这个
安装完成,然后你将可以看到c/c++项目选项
创建新项目时。
第 2 步:安装 Cygwin
由于您在 ubuntu 10.10 中工作,因此不需要执行此步骤。所以你会
能够使用终端。
第三步:安装Android ndk
下载ndk并将其放在android sdk所在的文件夹中。
步骤4:创建一个新的android项目并在该文件夹中创建一个名为jni的新文件夹
添加链接中给出的 make 文件和 .c 文件。
第 5 步:打开终端,使用 cd 命令导航到项目目录。
现在从项目文件位置执行 ndk-build 命令。
这将为您提供 .so 文件,这意味着库文件已生成。
如果您在此处收到错误,则安装和其他步骤将出现错误。
第 6 步:最后一步是创建 java 文件。
现在您可以运行该应用程序。你会得到输出
I followed the Steps given in the link mentioned by Santhosh_pulliman and I got the output. This may help you.
Step 1 : Installation of C / C++ support in eclipse
This will enable you to do c language program in eclipse. If this
Installation completed, then you will be able to see the c / c++ project option
while creating new project.
Step 2 : Installing Cygwin
This step is not needed for you as you are working in ubuntu 10.10. So you will
be able to use the terminal.
Step 3 : Installing Android ndk
Download the ndk and put it in the folder where you have you android sdk.
Step 4 : Create a new android project and create a new folder named jni and in that folder
add the make file and .c file as given in the link.
Step 5 : Open the terminal, navigate to your project directory by using cd command.
Now from the project file location execute the ndk-build command.
This will give you .so file which means the library file is generated.
If you are getting error here then the installation and other step will be having error.
Step 6 : Final step is creating your java file.
Now you can run the application. you will get the output