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

发布于 2025-01-08 10:37:55 字数 117 浏览 2 评论 0原文

我使用的是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜味超标? 2025-01-15 10:37:55

我按照 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 命令导航到项目目录。

     cd /path of your workspace/project name 

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

/your ndk path/android-ndk-r4/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.

     cd /path of your workspace/project name 

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

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文