使用 NDK 构建音频处理 Little Endian SDK
Posted
技术标签:
【中文标题】使用 NDK 构建音频处理 Little Endian SDK【英文标题】:Building audio processing Little Endian SDK with NDK 【发布时间】:2014-10-14 21:20:21 【问题描述】:我正在尝试使用 ndk-build
在 android 应用程序中使用来自 Little Endian 的本机代码进行音频处理(我还没有 JNI)。
当我在 jni dir 中执行 ndk-build 时,我得到了($USER_PATH 是我计算机上目录的路径):
Android NDK: WARNING: Rebuilding libc++ libraries from sources!
Android NDK: You might want to use $NDK/build/tools/build-cxx-stl.sh --stl=libc++
Android NDK: in order to build prebuilt versions to speed up your builds!
Android NDK: ERROR:$USER_PATH/android-ndk-r10/sources/android/compiler-rt/Android.mk:compiler_rt_shared: LOCAL_SRC_FILES points to a missing file
Android NDK: $USER_PATH/Android/android-ndk-r10/sources/android/compiler-rt/libs/armeabi/libcompiler_rt_shared.so exists or that its path is correct
$USER_PATH/android-ndk-r10/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Stop.
我看到这是因为 PREBUILT_STATIC_LIBRARY 指向丢失的文件。
我该如何解决这个问题?
目录结构:
有.mk文件:
Android.mk
MY_LOCAL_PATH := $(call my-dir)
ifndef LE_SDK_PATH
LE_SDK_PATH := $(call my-dir)
endif
include $(MY_LOCAL_PATH)/le_audioio.mk
include $(MY_LOCAL_PATH)/le_utility.mk
LOCAL_PATH := $MY_LOCAL_PATH
include $(CLEAR_VARS)
LOCAL_MODULE := little-endian
LOCAL_STATIC_LIBRARIES := le_audioio le_utility
include $(BUILD_SHARED_LIBRARY)
应用程序.mk
APP_PLATFORM := android-14
APP_STL := c++_static
APP_ABI := armeabi armeabi-v7a x86
APP_OPTIM := release
APP_CFLAGS += -g
NDK_TOOLCHAIN_VERSION := clang
le_audioio.mk
ifndef LE_SDK_PATH
LE_SDK_PATH := $(call my-dir)
endif
LOCAL_PATH:= $(LE_SDK_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := le_audioio
LOCAL_EXPORT_C_INCLUDES := $(abspath $(LE_SDK_PATH)/include)
LOCAL_EXPORT_LDLIBS += -lOpenSLES
ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_SRC_FILES := libs/development/libAudioIO_Android_x86-32_SSSE3.a
else
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_ARM_NEON := true
LOCAL_SRC_FILES := libs/development/libAudioIO_Android_ARMv7a_NEON.a
else
LOCAL_SRC_FILES := libs/release/libAudioIO_Android_ARMv6_VFP2.a
endif
endif
include $(PREBUILT_STATIC_LIBRARY)
le_utilityio.mk
ifndef LE_SDK_PATH
LE_SDK_PATH := $(call my-dir)
endif
LOCAL_PATH:= $(LE_SDK_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := le_utility
LOCAL_EXPORT_C_INCLUDES := $(abspath $(LE_SDK_PATH)/include)
LOCAL_EXPORT_LDLIBS += -landroid -llog
ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_SRC_FILES := libs/development/libUtility_Android_x86-32_SSSE3.a
else
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_ARM_NEON := true
LOCAL_SRC_FILES := libs/development/libUtility_Android_ARMv7a_NEON.a
else
LOCAL_SRC_FILES := libs/release/libUtility_Android_ARMv6_VFP2.a
LOCAL_EXPORT_LDLIBS += -latomic
endif
endif
include $(PREBUILT_STATIC_LIBRARY)
【问题讨论】:
我检查了从 Application.mk 构建中删除 NDK_TOOLCHAIN_VERSION := clang 和 APP_STL := c++_static 是否成功。 看起来您正在混合共享库和静态库所需的逻辑。你真正想在你的应用程序中使用什么?当前逻辑指定 BUILD_SHARED_LIBRARY 但请求 C++ stl 的静态版本。 【参考方案1】:试试this Google 的音频应用新解决方案。
【讨论】:
以上是关于使用 NDK 构建音频处理 Little Endian SDK的主要内容,如果未能解决你的问题,请参考以下文章
使用ninja -C out/Release指令编译安卓Webrtc的SDK报错找不到android ndk处理方式
超级强大的 Android NDK:获取 positionPercent 以更新音频进度搜索栏