开发者

Problems compiling a C library for the Android NDK

I need some advice. I'm trying to use oRTP, which is a C library, in my Android app. I have the source for oRTP. As far as I can tell what I need to do is to compile oRTP into a static library using ndk-build. Then I need to write a C wrapper around libortp where the functions are named according to the JNI's conventions. What I need to know is:

  1. Is the Android.mk file here supposed to compile the library correctly? Because running ndk-build on it doesn't work (开发者_高级运维no output, no files created).
  2. Is the procedure I outlined above correct or is there a simpler way?


OK, got it working. The supplied Android.mk file is correct. It just doesn't do anything if you use it as is. You need to compile something using the static library for the compiler to do something. In my case I added the code below to the bottom of the Android.mk file. rtpsendc.c is a c file which has code that uses libortp.

include $(CLEAR_VARS)
LOCAL_MODULE := ortpwrapper
LOCAL_SRC_FILES := rtpsendc.c
LOCAL_STATIC_LIBRARIES := ortp
LOCAL_C_INCLUDES += \
        $(LOCAL_PATH) \
        $(LOCAL_PATH)/include 
LOCAL_LDLIBS := -llog   

include $(BUILD_SHARED_LIBRARY)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜