0

当我在 Eclipse 中的 android 上构建 libjpeg 时遇到问题。jni 包含 Android.mk 如下:

    LOCAL_PATH := $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_MODULE    := hello-jni
    LOCAL_SRC_FILES := hello-jni.c
    #LOCAL_C_INCLUDES := $(LOCAL_PATH)/jpeg8d-master
    #LOCAL_STATIC_LIBRARIES := libjpeg
    include $(BUILD_STATIC_LIBRARY)
    #include $(LOCAL_PATH)/jpeg8d-master/Android.mk

jpeg8d 是我从github下载的源代码。安卓.mk

LOCAL_PATH:= $(call my-dir)
# ------------------------------------------------------------------
# Static library for Cocos
# ------------------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := cocos_jpeg_static
LOCAL_MODULE_FILENAME := libjpeg
LOCAL_SRC_FILES := \
    jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
    jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
    jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
    jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
    jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c \
    jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
    jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \
    jquant2.c jutils.c jmemmgr.c jcarith.c jdarith.c jaricom.c

# Use the no backing store memory manager provided by
# libjpeg. See install.txt
LOCAL_SRC_FILES += \
    jmemnobs.c

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
include $(BUILD_STATIC_LIBRARY)

ndk-build 给出提示:

make: 对“所有”无事可做。

但是,如果我设置 jpeg8d Android.mk BUILD_SHARED_LIBRARY,我会得到libjpeg.so. 我不知道为什么。谁能帮我 ?

4

1 回答 1

1

解决方案:您可以通过LOCAL_MODULE_FILENAME. 在我的问题中,我设置了LOCAL_MODULE_FILENAME=libjpeg,但我没有将 APP_MODULES:=cocos_jpeg_static(记住cocos_jpeg_staic不是)添加到LOCAL_MODULEjni目录中而不是jpeg8d -master目录中。LOCAL_MODULE_FILENAMEApplication.mk

当我将此libjpeg.a行添加到Appliction.mk

APP_MODULES:=cocos_jpeg_static
于 2013-03-28T01:26:49.340 回答