android_ndk_jni_cygwin环境

----------------------------------------------------------------------
android ndk下载解压缩 r4以后无需配置
----------------------------------------------------------------------
交叉编译环境cygwin下载,安装时选择 devel Install
----------------------------------------------------------------------
运行cygwin生成用户目录,修改.bash_profile,添加环境变量,例如

NDK_ROOT=/cygdrive/d/android-ndk-r5b
export NDK_ROOT
export PATH="$NDK_ROOT:$PATH"
----------------------------------------------------------------------
android项目配置

项目目录下建立jni目录,准备好make文件和代码,例如:
Android.mk
hello-jni.c
----------------------------------------------------------------------
从cygwin进入项目目录,运行ndk-build脚本,例如

cd /cygdrive/d/work/android/hello-jni
ndk-build

自动生成 libs/armeabi/libhello-jni.so

引用方法:
static {
System.loadLibrary("hello-jni");
}
----------------------------------------------------------------------

----------------------------------------------------------------------
android项目属性配置Builder联动:新建Program Builder

D:/cygwin/bin/bash.exe
D:/cygwin/home/lin
--login -c "cd /cygdrive/d/work/android/hello-jni && /cygdrive/d/android-ndk-r5b/ndk-build"
----------------------------------------------------------------------

你可能感兴趣的:(android)