1.错误提示:
undefined reference to '__android_log_write'
解决方法:
在Android.mk
文件中引入 liblog库。
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
参考链接: http://blog.csdn.net/go_to_learn/article/details/7556203
2.错误提示:
fatal error: 'android_runtime/AndroidRuntime.h' file not found
#include "android_runtime/AndroidRuntime.h"
提示找不到头文件
解决方法:
1.在jni
文件夹中创建include
文件夹,在include
文件夹中放入android_runtime/AndroidRuntime.h
文件
2.在Android.mk
文件中添加头文件路径。
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
或者
LOCAL_CFLAGS := -I./include/
但使用 LOCAL_C_INCLUDES 更好,因为这样也可以通过 ndk-gdb 使用可用于本地调试的路径。
3.错误提示:
error: undefined reference to 'android::AndroidRuntime::mJavaVM'
解决方案: