在eclipse中配置android ndk的自动编译环境builders
2014-04-08 16:43
891 查看
无论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/
When editing native JNI code in an Android project using the Android NDK you 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 necessary
Start by right clicking on your android project (named hello-neon in the below screenshots) with JNI resources, and select
A new dialog will open presenting a list of builder types. Select the
In the
Name:NDK BuilderLocation:/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-buildWorking Directory:${workspace_loc:/hello-neon} (replace hello-neon with your project name. Press the
The result should look something like the below:
Now continue with the refresh tab. Make sure the two checkboxes
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 the
Now skip the
Since the NDK build only needs to happen when editing files in the
Now finally press
每次修改完 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 the Android NDK you may configure Eclipse to automaticallyrebuild 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 necessary
ndk-buildbinary):
Start by right clicking on your android project (named hello-neon in the below screenshots) with JNI resources, and select
Properties. In the resulting dialog, choose the
Buildersentry in the list to the left and press the
New...button:
A new dialog will open presenting a list of builder types. Select the
Programtype and press the
OKbutton:
In the
Maintab, fill in the following:
Name:NDK BuilderLocation:/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-buildWorking Directory:${workspace_loc:/hello-neon} (replace hello-neon with your project name. Press the
Browse Workspace...button to select it graphically)
The result should look something like the below:
Now continue with the refresh tab. Make sure the two checkboxes
Refresh resources upon completion.and
Recursively include sub-foldersare checked. Choose the
Specific resourcesradio button and press the
Specify 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 the
Finishbutton:
Now skip the
Environmenttab and go to the final
Build Optionstab. Make sure the
Run the builder: During auto buildscheckbox is checked.
Since the NDK build only needs to happen when editing files in the
jnifolder, check that folder and press the
Finishbutton.
Now finally press
OKin the builder configuration dialog - the new NDK builder should now be up and running. Try editing any file in the
jnifolder and check that the
Consoleview produces output from the build process:
相关文章推荐
- 在eclipse中配置android ndk的自动编译环境builders
- 在eclipse中配置android ndk的自动编译环境builders
- 在eclipse中配置android ndk的自动编译环境builders
- 在eclipse中配置android ndk的自动编译环境builders
- 在eclipse中配置android ndk的自动编译环境builders
- 在Eclipse中配置NDK自动编译环境builders
- 在Eclipse中配置NDK自动编译环境builders
- 在Eclipse中配置NDK自动编译环境builders
- 在Eclipse中配置NDK自动编译环境builders
- 在Eclipse中配置NDK自动编译环境builders
- 在Eclipse中配置NDK自动编译环境builders
- 在Eclipse中配置NDK自动编译环境builders
- 在Eclipse中配置NDK自动编译环境builders
- 在Eclipse中配置NDK自动编译环境builders
- Windows/Ubuntu 在Eclipse中配置NDK自动编译环境builders
- 在Eclipse中配置NDK自动编译环境builders
- Mac下配置Android NDK环境并搭建Cocos2d-x环境并Eclipse正常编译运行Cocos2dX自带TestsDemo项目
- Windows7 下Eclipse集成Cygwin配置Android NDK环境编译JNI库(1)
- eclipse里配置Android ndk环境,直接用eclipse编译.so文件
- 【iOS-cocos2d-X 游戏开发之三】Mac下配置Android NDK环境并搭建Cocos2d-x环境并Eclipse正常编译运行!