无论linux还是mac在jni目录中直接运行 ndk-build 就可以生成 lib目录及所需要的 so文件; windows 装上lnx模拟器也是一样;
每次修改完 c++代码, 都要运行一下 ndk-build,然后在 eclipse中运行 java 程序;非常之麻烦; 之所以麻烦,归根于对强大的eclipse ide环境的不熟悉; 其实 eclipse可以配置 jni的自动编译选项; 及每次编译的时候 java 代码由 java编译器编译; 而 jni中的c++代码,则由 ndk-build来编译处理(其实里面也是g++在处理);
关于配置方法,极力推荐以下文章,不懂e文无所谓,看图片都明白了。。。
引用网址:http://mobilepearls.com/labs/ndk-builder-in-eclipse/
Setting up Automatic NDK Builds in Eclipse
When editing native JNI code in an Android project using theAndroid NDKyou may configure Eclipse to automatically rebuild your
project when editing native code, just as it does for java. The below steps shows how to perform the necessary configuration (note that this requires revision 4 or later of the NDK - previous revisions does not contain the necessaryndk-build
binary):
Start by right clicking on your android project (namedhello-neonin the below screenshots) with JNI resources, and selectProperties
. In the resulting dialog, choose theBuilders
entry
in the list to the left and press theNew...
button:
A new dialog will open presenting a list of builder types. Select theProgram
type and press theOK
button:
In theMain
tab, fill in the following:
Name:
NDK Builder
Location:
/opt/android-ndk/ndk-build (or wherever your ndk-build binary is). You may use a variable as in ${system_property:user.home}/lib/android-ndk/ndk-build
Working Directory:
${workspace_loc:/hello-neon} (replace hello-neon with your project name. Press theBrowse Workspace...
button to select it graphically)
The result should look something like the below:
Now continue with the refresh tab. Make sure the two checkboxesRefresh resources upon completion.
andRecursively include sub-folders
are checked. Choose theSpecific
resources
radio button and press theSpecify Resources...
button:
Since the ndk-build process will generate files in the lib folder, we want Eclipse to discover changes made there without having to refresh manually. So select the lib folder in the project (create one if necessary) and press theFinish
button:
Now skip theEnvironment
tab and go to the finalBuild Options
tab. Make sure theRun the builder: During auto builds
checkbox is checked.
Since the NDK build only needs to happen when editing files in thejni
folder, check that folder and press theFinish
button.
Now finally pressOK
in the builder configuration dialog - the new NDK builder should now be up and running. Try editing any file in thejni
folder and check that theConsole
view
produces output from the build process:
分享到:
相关推荐
详细介绍了在eclipse中android项目下c/c++代码的自动编译,和在eclipse中用ant生成ndk需要的jni头文件,加速ndk的开发,因为是原创,费了不少心力和时间,所以设了6分,有人反映太贵了,现在调成3分,这下大家满意了...
eclipse中ndk 自动编译配置
ubuntu下android ndk编译环境搭建,android应用程序开发,环境编译
Eclipse集成Android NDK说明 1 2 为什么要用NDK? 2 3 为什么要集成? 2 4 怎样操作? 2 4.1 预备条件 2 4.1.1 Cygwin 2 4.1.2 Eclipse 2 4.1.3 Eclipse CDT 3 4.1.4 Android SDK 3 4.1.5 Android NDK 3 ...
Windows下Eclipse搭建Android_NDK开发环境
该资源教程,是在eclipse下实现的androidndk开发的文档,简单易懂,手把手教程!
使用Android NDK编译Android平台的eXosip库,有静态库和动态库。
arm平台下使用ndk工具交叉编译python,用于android系统;android-arm平台ndk交叉编译python
android开发有时需要开发c/c++插件,这就需要用到NDK(Native Development Kit),如果eclipse中没有配置NDK的选项则需要此插件。解压后对应放入eclipse目录下的features和plugins文件夹重启eclipse就可以看到NDK的...
eclipse android ndk环境配置及项目编译超详细攻略,包括cygwin的安装,配置
NDK提供了一系列的工具,帮助开发者快速开发C(或C++)的动态库,并能自动将so和java应用一起打包成apk,并集成了交叉编译器,并提供了相应的mk文件隔离CPU、平台、ABI等差异,开发人员只需要简单修改mk文件
windows下eclipse集成cygwin编译android_NDK.doc
在Android下用C/C++开发,新版本的配置不需要cygwin
Android NDK 交叉编译工具 Android NDK 交叉编译工具
详细介绍android ndk编译环境搭建,可以自行编译android app所需的C++/C代码实现的高效率功能动态库文件,借JAVA层调用.
最新版的live555 ,android的移植,大家瞧一瞧,看一看
详细的描述了Android NDK下编译ffmpeg开源库的步骤。
Eclipse配置NDK开发环境
解决eclipse无NDK选项设置问题,复制下载文件到eclipse目录的“plugins”下面。如我的复制到"\eclipse\plugins\com.android.ide.eclipse.ndk_23.0.2.1259578.jar"。