我正在尝试在我的 MacOS Android Studio 2.3.2 上构建 AndEngine 示例。
但是得到这个错误。无法弄清楚是什么问题。奇怪的是,相同的项目通常在 Windows 上构建,相同版本的 Android Studio。
> FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':andEngine:externalNativeBuildRelease'.
> Build command failed.
Error while executing process /Users/apple/Library/Android/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/apple/Documents/workspace/AndroidStudio/AndEngineExamples-GLES2/andEngine/src/main/jni/Android.mk
NDK_APPLICATION_MK=/Users/apple/Documents/workspace/AndroidStudio/AndEngineExamples-GLES2/andEngine/src/main/jni/Application.mk APP_ABI=mips NDK_ALL_ABIS=mips NDK_DEBUG=0 APP_PLATFORM=android-9 NDK_OUT=/Users/apple/Documents/workspace/AndroidStudio/AndEngineExamples-GLES2/andEngine/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=/Users/apple/Documents/workspace/AndroidStudio/AndEngineExamples-GLES2/andEngine/build/intermediates/ndkBuild/release/lib /Users/apple/Documents/workspace/AndroidStudio/AndEngineExamples-GLES2/andEngine/build/intermediates/ndkBuild/release/obj/local/mips/libandengine.so}
Android NDK: android-9 is unsupported. Using minimum supported version android-14.
[mips] Compile++ : andengine_shared <= BufferUtils.cpp
/Users/apple/Documents/workspace/AndroidStudio/AndEngineExamples-GLES2/andEngine/src/main/jni/src/BufferUtils.cpp:13:2: error: use of undeclared identifier 'memcpy'
memcpy(bufferAddress, dataAddress + pOffset, pLength << 2);
^
我的 Application.mk 文件:
# Build both ARMv5TE and ARMv7-A and x86 machine code.
APP_ABI := armeabi armeabi-v7a x86
APP_STL := gnustl_shared
和 Android.mk:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := andengine_shared
LOCAL_MODULE_FILENAME := libandengine
LOCAL_CFLAGS := -Werror
LOCAL_SRC_FILES := src/GLES20Fix.c \
src/BufferUtils.cpp
LOCAL_LDLIBS := -lGLESv2
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/src
include $(BUILD_SHARED_LIBRARY)
最佳答案
Android NDK: android-9 is unsupported. Using minimum supported version android-14.
添加
APP_PLATFORM := android-14
在 Application.mk
文件如果您没有该行,那么您的 SDK 版本将从 project.properties 文件中获取。
关于build - 构建 AndEngine 示例的 NDK 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44401182/