如何使用 Eclipse 安装和构建 NDK? [英] How to install and Build NDK with eclipse?

查看:32
本文介绍了如何使用 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.

提前致谢.

推荐答案

我按照 Santhosh_pulliman 提到的链接中给出的步骤操作,得到了输出.这可能会对您有所帮助.

I followed the Steps given in the link mentioned by Santhosh_pulliman and I got the output. This may help you.

第 1 步:在 eclipse 中安装 C/C++ 支持这将使您能够在 eclipse 中执行 c 语言程序.如果这安装完成,然后就可以看到c/c++项目选项了在创建新项目时.

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.

第 2 步:安装 Cygwin由于您在 ubuntu 10.10 中工作,因此您不需要此步骤.所以你会可以使用终端.

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.

第 3 步:安装 Android ndk下载ndk并将其放在您拥有android sdk的文件夹中.

Step 3 : Installing Android ndk Download the ndk and put it in the folder where you have you android sdk.

第 4 步:创建一个新的 android 项目并在该文件夹中创建一个名为 jni 的新文件夹添加链接中给出的make文件和.c文件.

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.

第 5 步:打开终端,使用 cd 命令导航到您的项目目录.

Step 5 : Open the terminal, navigate to your project directory by using cd command.

     cd /path of your workspace/project name 

现在从项目文件位置执行 ndk-build 命令.

Now from the project file location execute the ndk-build command.

/your ndk path/android-ndk-r4/ndk-build

这将为您提供 .so 文件,这意味着已生成库文件.

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.

第 6 步:最后一步是创建您的 java 文件.

Step 6 : Final step is creating your java file.

现在您可以运行该应用程序了.你会得到输出

Now you can run the application. you will get the output

这篇关于如何使用 Eclipse 安装和构建 NDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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