1.ndk各個平臺的下載地址
Android NDK r9d
http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86.zip
http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86_64.zip
http://dl.google.com/android/ndk/android-ndk-r9d-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2
2.將相應平臺的包解壓
3.打開eclipse導入,選擇android下Existing Android Code Into Workspace,將解壓包android-ndk-r9d中samples中的一個工程導入進來
4.選擇剛纔導入的工程,右擊->新建->other->c/c++ 中選擇Convert to a C/C++ Project (Adds C/C++ Nature),然後next->finish.此時彈出的對話框選擇yes.
5.在這個工程上,右擊->屬性,點擊C/C++ Build 把Use default build command 的鉤去掉。在Build Command:寫上解壓包android-ndk-r9d下ndk-build的絕對路經。(windows下是ndk-build.cmd,liunx下idk-build.sh)最後,點擊OK。
6.在這個工程上,右擊->屬性,點開C/C++ General, 選擇Paths and Symbols,在include下把解壓包android-ndk-r9d下platforms相應平臺的include目錄添加進來就OK了。