1

我正在尝试在 Android 中编译 Speex 库。当我在共享模式下编译这个库时,一切都很好,但是当我尝试在静态模式下编译它时,ndk 似乎什么都不做并且它没有生成库。

我读过我只需要更改include $(BUILD_SHARED_LIBRARY)(BUILD_STATIC_LIBRARY)但这不起作用,库没有编译,我在控制台中没有任何错误。

安卓.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := speex

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
    LOCAL_CFLAGS += -DHAVE_NEON=1
endif

LOCAL_CFLAGS += -DHAVE_CONFIG_H

LOCAL_C_INCLUDES := ../include   \
               ../libspeex   \
               ../           \

LOCAL_SRC_FILES := ../libspeex/bits.c      \
           ../libspeex/buffer.c    \
           ../libspeex/cb_search.c \
               ...
           ../libspeex/vq.c        \
           ../libspeex/window.c    \

LOCAL_CFLAGS += -DANDROID

include $(BUILD_STATIC_LIBRARY)

应用程序.mk

APP_PROJECT_PATH := $(call my-dir)
APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/Android.mk
APP_STL := stlport_static
STLPORT_FORCE_REBUILD := true
APP_ABI := armeabi-v7a armeabi
APP_OPTIM := release 
APP_PLATFORM :=  android-8

怎么了?为什么 NDK 不编译库?

4

1 回答 1

2

我已经解决了它在同一个 Android.mk 中指定的问题,这是一个以共享模式编译的模块,它使用之前编译的静态库:

安卓.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := speex-static

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
    LOCAL_CFLAGS += -DHAVE_NEON=1
endif

LOCAL_CFLAGS += -DHAVE_CONFIG_H

LOCAL_C_INCLUDES := ../include   \
               ../libspeex   \
               ../           \

LOCAL_SRC_FILES := ../libspeex/bits.c      \
           ../libspeex/buffer.c    \
           ../libspeex/cb_search.c \
               ...
           ../libspeex/vq.c        \
           ../libspeex/window.c    \

LOCAL_CFLAGS += -DANDROID

include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
    LOCAL_CFLAGS += -DHAVE_NEON=1
endif
LOCAL_MODULE := speex
LOCAL_STATIC_LIBRARIES := speex-static
LOCAL_CFLAGS += -DANDROID
include $(BUILD_SHARED_LIBRARY)
于 2012-09-24T12:00:34.540 回答