日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

在eclipse中配置android ndk的自动编译环境builders

發(fā)布時間:2025/4/16 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 在eclipse中配置android ndk的自动编译环境builders 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
無論linux還是mac在jni目錄中直接運行 ?ndk-build 就可以生成 lib目錄及所需要的 so文件; windows 裝上lnx模擬器也是一樣; 每次修改完 c++代碼, 都要運行一下 ndk-build,然后在 eclipse中運行 java 程序;非常之麻煩; ? 之所以麻煩,歸根于對強大的eclipse ide環(huán)境的不熟悉; 其實 eclipse可以配置 jni的自動編譯選項; 及每次編譯的時候 java 代碼由 java編譯器編譯; ?而 jni中的c++代碼,則由 ndk-build來編譯處理(其實里面也是g++在處理);
關于配置方法,極力推薦以下文章,不懂e文無所謂,看圖片都明白了。。
引用網(wǎng)址: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 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:

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

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:

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:

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.

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

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?jnifolder and check that the?Console?view produces output from the build process:


轉(zhuǎn)自?http://lockriver.blog.163.com/blog/static/48723224201143111491801/

總結

以上是生活随笔為你收集整理的在eclipse中配置android ndk的自动编译环境builders的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。