包括标题文件Android JNI



我正在尝试在android上使用pjsip ../configure-android并制作dep并制作命令,生成了13个静态库。

我使用了在JNI文件夹中复制的Include文件夹。JNI文件夹中Android.mk的内容如下:

        LOCAL_PATH := $(call my-dir)
        include $(CLEAR_VARS)
        LOCAL_MODULE := libpj-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpj-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjlib-util-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjlib-util-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjmedia-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../voiper/pjsip_lib/libpjmedia-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjmedia-audiodev-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjmedia-audiodev-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjmedia-codec-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjmedia-codec-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjmedia-videodev-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjmedia-videodev-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjnath-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjnath-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjsdp-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjsdp-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjsip-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjsip-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjsip-simple-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjsip-simple-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjsip-ua-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjsip-ua-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjsua2-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjsua2-arm-unknown-linux-androideabi.a
        LOCAL_MODULE := libpjsua-arm-unknown-linux-androideabi
        LOCAL_SRC_FILES := ../pjsip_lib/libpjsua-arm-unknown-linux-androideabi.a
        include $(PREBUILT_STATIC_LIBRARY)
        include $(CLEAR_VARS)
        LOCAL_MODULE := dummy_pjsip_jni_module
        LOCAL_SRC_FILES := dummy_pjsua.c
        LOCAL_EXPORT_C_INCLUDES += ./include
        LOCAL_C_INCLUDES += ./include
        LOCAL_STATIC_LIBRARIES :=  libpj-arm-unknown-linux-androideabi libpjlib-util-arm-unknown-linux-androideabi libpjmedia-arm-unknown-linux-androideabi libpjmedia-audiodev-arm-unknown-linux-androideabi  libpjmedia-codec-arm-unknown-linux-androideabi libpjmedia-videodev-arm-unknown-linux-androideabi libpjnath-arm-unknown-linux-androideabi libpjsdp-arm-unknown-linux-androideabi libpjsip-arm-unknown-linux-androideabi libpjsip-simple-arm-unknown-linux-androideabi libpjsip-ua-arm-unknown-linux-androideabi libpjsua2-arm-unknown-linux-androideabi libpjsua-arm-unknown-linux-androideabi
        include $(BUILD_SHARED_LIBRARY)

我编写了一个简单的一行C文件,该文件仅包含一个包含文件夹的标头文件。然后,我从项目目录运行NDK-build,并且在包含文件夹中存在的标题文件中没有获取此类文件。没有应用程序。MK..我缺少什么?

编辑

'。'表示当前目录。" include"文件夹在JNI文件夹中

这里有几个问题:

1)每个预构建的静态库应具有自己的模块定义,即您的android.mk应该看起来像:

include $(CLEAR_VARS)
LOCAL_MODULE := libpj
LOCAL_SRC_FILES := libpj-arm-unknown-linux-androideabi.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libpjlib-util
LOCAL_SRC_FILES := libpjlib-util-arm-unknown-linux-androideabi.a
include $(PREBUILT_STATIC_LIBRARY)
... etc

请注意,模块名称不必与文件路径完全相同,这使其其余的内容更加清晰。

2)那个。将在构建时间转到您调用NDK-build的当前目录,您需要使用$(local_path)/inclage而不是参考正确的路径(假设您的android.mk在jni/jni/ni)。即:

include $(CLEAR_VARS)
LOCAL_MODULE := dummy_pjsip_jni_module
LOCAL_SRC_FILES := dummy_pjsua.c
LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES :=  libpj libpjlib-util libpjmedia libpjmedia-audiodev 
      libpjmedia-codec libpjmedia-videodev libpjnath 
      libpjsdp libpjsip libpjsip-simple libpjsip-ua 
      libpjsua2 libpjsua
include $(BUILD_SHARED_LIBRARY)

相关内容

  • 没有找到相关文章

最新更新