构建AndEngine示例的NDK时出错
Error when build NDK of AndEngine example
我正在尝试在我的 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.
在 Application.mk
文件中添加 APP_PLATFORM := android-14
如果您没有该行,则您的 SDK 版本取自 project.properties 个文件。
Android Studio 会覆盖您的 Application.mk 文件中的某些设置。例如,它会覆盖 APP_ABI。您应该添加
defaultConfig {
...
externalNativeBuild {
ndkBuild {
abiFilters "armeabi", "armeabi-v7a", "x86"
}
}
}
给你的 app/build.gradle。您不必担心最低支持版本为 android-14
的警告,但请注意 NDK r15,目前仍处于测试阶段。
我正在尝试在我的 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.
在 Application.mk
文件中添加 APP_PLATFORM := android-14
如果您没有该行,则您的 SDK 版本取自 project.properties 个文件。
Android Studio 会覆盖您的 Application.mk 文件中的某些设置。例如,它会覆盖 APP_ABI。您应该添加
defaultConfig {
...
externalNativeBuild {
ndkBuild {
abiFilters "armeabi", "armeabi-v7a", "x86"
}
}
}
给你的 app/build.gradle。您不必担心最低支持版本为 android-14
的警告,但请注意 NDK r15,目前仍处于测试阶段。