我正在尝试将此项目作为Android-NDK添加到Android Studio,但我一直收到错误消息:https://github.com/timsu/android-aac-enc

我按照本指南安装NDK和所有相关内容。然后,将jni folder添加到app\src\main\jni并将此行添加到build.gradle

android {
    externalNativeBuild {
        ndkBuild {
            path "src/main/jni/Android.mk"
        }
}


当我尝试同步项目时,得到以下error

Build command failed.

Error while executing process C:\Users\ThermalTake i7\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\ThermalTake i7\Desktop\StarMe Git\starme_android-code\app\src\main\jni\Android.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-19 NDK_OUT=C:/Users/ThermalTake i7/Desktop/StarMe Git/starme_android-code/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\Users\ThermalTake i7\Desktop\StarMe Git\starme_android-code\app\build\intermediates\ndkBuild\debug\lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
'C:\Users\ThermalTake' is not recognized as an internal or external command,
operable program or batch file.


搜索了一些答案后,我尝试将此行添加到build.gradle中:

android {
    defaultConfig
            {
                ndk {
                    abiFilters 'x86', 'x86_64', 'armeabi-v7a','arm64-v8a'
                }
            }


仍然出现相同的错误,我想念什么?
添加jni文件夹是我所要做的吗?

这也是Android.mk文件,可能是错误所在。

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
include $(LOCAL_PATH)/Config.mk

LOCAL_MODULE := aac-encoder

ENC_SRC := src

LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc

LOCAL_SRC_FILES = \
    aac-enc.c \
    $(ENC_SRC)/cmnMemory.c \
    basic_op/basicop2.c \
    basic_op/oper_32b.c \
    $(ENC_SRC)/aac_rom.c \
    $(ENC_SRC)/aacenc.c \
    $(ENC_SRC)/aacenc_core.c \
    $(ENC_SRC)/adj_thr.c \
    $(ENC_SRC)/band_nrg.c \
    $(ENC_SRC)/bit_cnt.c \
    $(ENC_SRC)/bitbuffer.c \
    $(ENC_SRC)/bitenc.c \
    $(ENC_SRC)/block_switch.c \
    $(ENC_SRC)/channel_map.c \
    $(ENC_SRC)/dyn_bits.c \
    $(ENC_SRC)/grp_data.c \
    $(ENC_SRC)/interface.c \
    $(ENC_SRC)/line_pe.c \
    $(ENC_SRC)/memalign.c \
    $(ENC_SRC)/ms_stereo.c \
    $(ENC_SRC)/pre_echo_control.c \
    $(ENC_SRC)/psy_configuration.c \
    $(ENC_SRC)/psy_main.c \
    $(ENC_SRC)/qc_main.c \
    $(ENC_SRC)/quantize.c \
    $(ENC_SRC)/sf_estim.c \
    $(ENC_SRC)/spreading.c \
    $(ENC_SRC)/stat_bits.c \
    $(ENC_SRC)/tns.c \
    $(ENC_SRC)/transform.c

ifeq ($(VOTT), v5)
LOCAL_SRC_FILES += \
    $(ENC_SRC)/asm/ARMV5E/AutoCorrelation_v5.s \
    $(ENC_SRC)/asm/ARMV5E/band_nrg_v5.s \
    $(ENC_SRC)/asm/ARMV5E/CalcWindowEnergy_v5.s \
    $(ENC_SRC)/asm/ARMV5E/PrePostMDCT_v5.s \
    $(ENC_SRC)/asm/ARMV5E/R4R8First_v5.s \
    $(ENC_SRC)/asm/ARMV5E/Radix4FFT_v5.s
endif

ifeq ($(VOTT), v7)
LOCAL_SRC_FILES += \
    $(ENC_SRC)/asm/ARMV5E/AutoCorrelation_v5.s \
    $(ENC_SRC)/asm/ARMV5E/band_nrg_v5.s \
    $(ENC_SRC)/asm/ARMV5E/CalcWindowEnergy_v5.s \
    $(ENC_SRC)/asm/ARMV7/PrePostMDCT_v7.s \
    $(ENC_SRC)/asm/ARMV7/R4R8First_v7.s \
    $(ENC_SRC)/asm/ARMV7/Radix4FFT_v7.s
endif

LOCAL_ARM_MODE := arm

LOCAL_LDLIBS := -llog

LOCAL_STATIC_LIBRARIES :=
LOCAL_SHARED_LIBRARIES :=

LOCAL_CFLAGS := $(VO_CFLAGS)

ifeq ($(VOTT), v5)
LOCAL_CFLAGS += -DARMV5E -DARM_INASM -DARMV5_INASM
LOCAL_C_INCLUDES += $(ENC_SRC)/asm/ARMV5E
endif

ifeq ($(VOTT), v7)
LOCAL_CFLAGS += -DARMV5E -DARMV7Neon -DARM_INASM -DARMV5_INASM -DARMV6_INASM
LOCAL_C_INCLUDES += $(ENC_SRC)/asm/ARMV5E
LOCAL_C_INCLUDES += $(ENC_SRC)/asm/ARMV7
endif

include $(BUILD_SHARED_LIBRARY)


可能是因为我没有包含NDK_MODULE_PATH吗?

最佳答案

NDK不能安装在有空格的路径中。与使用NDK的项目相同。

对于您而言,最好的解决方法是将所有Android SDK移至目录C:\ AndroidSdk。

10-05 22:49
查看更多