且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何安装和使用Eclipse构建NDK?

更新时间:2023-11-16 21:34:16

我也跟着由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步:安装NDK的Andr​​oid
         下载NDK,并把它放在你有Android SDK中的文件夹中。

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

步骤4:创建一个新的Andr​​oid项目,并创建一个新文件夹命名为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.

第五步:打开终端,用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.

第六步:最后一步是创建你的java文件

Step 6 : Final step is creating your java file.

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

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