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 ndk-build binary):

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 Builders entry in the list to the left and press the New... button:

linux android NDK 导入ecplise_第1张图片

A new dialog will open presenting a list of builder types. Select the Program type and press the OK button:

linux android NDK 导入ecplise_第2张图片

In the Main 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 the Browse Workspace... button to select it graphically)

The result should look something like the below:

linux android NDK 导入ecplise_第3张图片

Now continue with the refresh tab. Make sure the two checkboxes Refresh resources upon completion. and Recursively include sub-folders are checked. Choose the Specific resources radio 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 Finish button:

linux android NDK 导入ecplise_第4张图片

Now skip the Environment tab and go to the final Build Options tab. Make sure the Run the builder: During auto builds checkbox is checked.

linux android NDK 导入ecplise_第5张图片

Since the NDK build only needs to happen when editing files in the jni folder, check that folder and press the Finish button.

linux android NDK 导入ecplise_第6张图片

Now finally press OK in the builder configuration dialog - the new NDK builder should now be up and running. Try editing any file in the jni folder and check that the Console view produces output from the build process:

linux android NDK 导入ecplise_第7张图片

更多相关文章

  1. Android 自定义控件之图片裁剪
  2. android访问网络图片
  3. android checkbox 定制(修改checkbox 的图片)
  4. 【Android】简单图片浏览器
  5. android图像处理系列之三--图片色调饱和度、色相、亮度处理
  6. Android使用xml自定义图片
  7. Android 图片缩放与旋转
  8. android 读取,写入图片到sd卡源码

随机推荐

  1. Android扫描条形码实现
  2. Android官方ORM数据库Room技术解决方案简
  3. Android(安卓)中创建avd和sdcard
  4. Android系统简介
  5. Android(安卓)Handler消息机制从原理到应
  6. 什么是android market?国内三大类android
  7. 分享:Android浏览器,用NDK C++做底层开发
  8. Android入门教程(三)之------导入现有And
  9. Android介绍与前景
  10. Facebook Home开启Android后应用时代