从本教程。
看到我有一个名为 as 的预构建静态库stackoverflow.a
,它有stackoverflow.h
现在我想使用该静态库的功能
ndk_demo.c
//那个教程有这个文件
对于里面ndk_demo.c
我已经添加了
#include 'stackoverflow.h'
编辑
inside `android-ndk-r7c`
|
apps
|
ndk_demo
|
-----------------
| |
project Application.mk
|
--------------------
| |
all other |
folder jni
|
-------------------------------------------------------------------
| | | | |
ndk_demo.c stackoverflow.h lib com_marakana Android.mk
| _NativeLib.h
|
--------------------
| |
Android.mk libstackoverflow.a
现在应用程序.mk
APP_PROJECT_PATH := $(call my-dir)/project
APP_MODULES := ndk_demo stackover
现在jni/Android.mk
include $(call all-subdir-makefiles)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ndk_demo
LOCAL_SRC_FILES := ndk_demo.c
LOCAL_STATIC_LIBRARIES := stackover
include $(BUILD_SHARED_LIBRARY)
现在jni/lib/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := stackover
LOCAL_SRC_FILES := libstackoverflow.a
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_PATH := $(call my-dir)
现在从android-ndk-r7c
我运行的目录
make APP=ndk_demo
它向我显示错误
Android NDK: Building for application 'ndk_demo'
make: *** No rule to make target `build/core/ndk_demo.c', needed by `out/apps/ndk_demo/armeabi/objs/ndk_demo/ndk_demo.o'. Stop.
为什么发生这种情况我没有得到?
如果我评论
#include $(call all-subdir-makefiles)
从那时jni/Android.mk
起它显示以下错误
Android NDK: Building for application 'ndk_demo'
Compile thumb : ndk_demo <= ndk_demo.c
SharedLibrary : libndk_demo.so
./out/apps/ndk_demo/armeabi/objs/ndk_demo/ndk_demo.o: In function `Java_com_marakana_NativeLib_hello':
/home/jeegar/android-ndk-r7c/apps/ndk_demo/project/jni/ndk_demo.c:10: undefined reference to `stackoverflowInit'
collect2: ld returned 1 exit status
make: *** [out/apps/ndk_demo/armeabi/libndk_demo.so] Error 1