Android NDK开发(Ubuntu 10)
1.下载Android NDK
http://dl.google.com/android/ndk/android-ndk-r4b-linux-x86.zip
2.配置NDK环境
$>vi ~/.bashrc
增加:
NDK=~/Android/android-ndk-r4b
export NDK
3.编写代码
Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jniDemo
LOCAL_SRC_FILES := com_test_android_jni_Jni.c
include $(BUILD_SHARED_LIBRARY)
4.编译
用两种方法:
1)在目标工程目录下编译:
$NDK/ndk-build
2) 在任意目录下编译:
$NDK/ndk-build -C ~/yournkd/sample/hello-jni