安装和放大器;使用Android NDK Eclipse中 [英] Installing & using the Android NDK in Eclipse

查看:209
本文介绍了安装和放大器;使用Android NDK Eclipse中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经运行了Android SDK,而现在在Eclipse(MAC OSX)。我已经下载了NDK,并在Eclipse安装在C / C ++工具,但是任何人都可以指导我如何使用NDK?举例来说,我只是创建像普通的Andr​​oid项目,并与NDK呢?

I've been running the Android SDK for a while now in Eclipse (MAC OSX). I've downloaded the NDK and installed the C/C++ tools in Eclipse, but could anyone guide me on using the NDK? For example, do I just create an Android project like normal and build it with the NDK instead?

真的可以做一个体面的教程,如果有人知道任何。

Really could do with a decent tutorial if anyone know of any.

编辑:行,所以我现在已经安装NDK(我认为),但没有任何人有任何想法如何使用它?我就这样(摘自<一个href="http://sseyod.blogspot.com/2009/08/android-jnindk-notes-on-getting-started.html">here):

OK so I have the NDK installed now (I think) but does anyone have any idea how to use it? I got as far as this (taken from here):

运行终端

CD〜/ Android的NDK-1.5_r1

cd ~/android-ndk-1.5_r1

让APP = HELLO-JNI

make APP=hello-jni

为了运行HELLO-JNI示例应用程序,但我得到的终端说法错误:

In order to run the hello-jni sample application, but I get an error in terminal saying:

的Andr​​oid NDK:APP​​变量定义为   未知应用程序:hellojni
  Android的NDK:您可能需要使用   执行下列操作之一:
  建立/核心/ main.mk:81: * 的安卓   NDK:中止。停止。

Android NDK: APP variable defined to unknown applications: hellojni
Android NDK: You might want to use one of the following:
build/core/main.mk:81: * Android NDK: Aborting . Stop.

任何想法,为什么?

推荐答案

尽可能简单,我可以形容它,在Eclipse中使用NDK的构建从Android应用程序需要两个步骤。

As simply as I can describe it, building an Android app from within Eclipse that uses the NDK requires two steps.

首先,你的终端里面,你需要运行NDK您的项目构建脚本。该目录中的cd到你的项目的根目录下,然后执行NDK-构建脚本。

First, inside your terminal you need to run the NDK build script on your project. cd into the root of your project directory and then execute the ndk-build script within that directory.

例如:

cd ~/workspace/hello-jni
./~/android-ndk-1.5_r1/ndk-build

这样做后,你应该会看到一些输出,结果在创建OBJ目录中的项目目录中的* .so文件中。

After doing this, you should see some output that results in the creation of a *.SO file within the obj directory within your project directory.

一旦你的* .so文件,最后一步,通过Eclipse中构建了Android NDK的应用是与Eclipse就像你盖了任何其他应用程序,然后将其部署进行测试。

Once you have the *.SO file, the final step to building an application with the Android NDK through Eclipse is to build it with Eclipse like you would any other application and then deploy it for testing.

如果您进行任何更改的C / C ++ code,你需要重复步骤之一,在Eclipse中再次构建和部署应用程序之前,重新生成* .so文件。

If you make any changes to the C/C++ code you'll need to repeat step one and regenerate your *.SO file before building and deploying your application from within Eclipse again.

我想指出,通过使用Android NDK的Andr​​oid应用程序仍然基于Java的。他们只是用code由 Java本地接口的方式写在C / C ++进行通信。

I would like to note that by using the Android NDK your android apps are still based upon Java. They're just communicating with code written in C/C++ by way of the Java Native Interface.

最后,我不知道有任何Eclipse插件,将与NDK的发展援助。我知道的一切关于NDK我已经学会官方的Andr​​oid NDK文档。请随意发表意见,并让我知道如果有什么我可以清理我的反应。

Finally, I am not aware of any Eclipse plugins that will aid with NDK development. Everything I know about the NDK I have learned the official Android NDK documentation. Please feel free to comment and let me know if there anything I can clear up in my response.

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

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