我试图在我的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)
答案 0 :(得分:2)
Android NDK:不支持android-9。使用最低支持版本 机器人-14。
在APP_PLATFORM := android-14
档案
Application.mk
如果您没有该行,则SDK的版本将从project.properties文件中获取。
答案 1 :(得分:0)
Android Studio会覆盖Application.mk文件中的某些设置。例如,它会覆盖 APP_ABI 。你应该添加
defaultConfig {
...
externalNativeBuild {
ndkBuild {
abiFilters "armeabi", "armeabi-v7a", "x86"
}
}
}
到 app / build.gradle 。您不应该担心最低支持版本为android-14
的警告,但请注意NDK r15,目前仍处于测试阶段。