gpt4 book ai didi

java - 错误 :error: '__ANDROID_API__' macro redefined [-Werror, -Wmacro-redefined] -Android Studio

转载 作者:行者123 更新时间:2023-11-30 00:25:43 25 4
gpt4 key购买 nike

我在一个项目中遇到了这个错误,在这个项目中我使用了“AndEngine”的以下模块,

1) 和引擎2)和EnginePhysicsBox2D扩展3) 和EngineTexturePackerExtension

以前(2 - 3 个月前),项目执行正常。现在,当我尝试执行代码时,我遇到了这个错误。

当我试图从“andEngine”模块的“Android.mk”评论“LOCAL_CFLAGS:= -Werror”行时,我得到如下错误,

[armeabi-v7a] Compile++ arm  : andenginephysicsbox2dextension <= b2PolygonAndCircleContact.cpp
In file included from <built-in>:346:
<command line>:6:9: warning: '__ANDROID_API__' macro redefined [-Wmacro-redefined]
#define __ANDROID_API__ 14
^
<built-in>:338:9: note: previous definition is here
#define __ANDROID_API__ 9
^
error: error opening 'C:/Users/.../andEnginePhysicsBox2DExtension/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/andenginephysicsbox2dextension/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.o.d': No such file or directory
1 warning and 1 error generated.
make: *** [C:/Users/.../andEnginePhysicsBox2DExtension/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/andenginephysicsbox2dextension/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.o] Error 1

仅供引用...安卓工作室:2.3.3。NDK:是最新的。

提前致谢。

最佳答案

经过长时间的研究,终于找到了解决方案。

你要做的就是,

1) 在“andEngine”的“Android.mk”文件中,将“LOCAL_CFLAGS := -Werror”这一行替换为“LOCAL_CFLAGS := -w”。其中,“-Werror”显示警告,因为它是一个错误,“-w”抑制与“andEngine”和其他模块相关的所有警告(不是实际错误)。

2) 请清理项目,它应该在大多数情况下都能正常工作。如果您仍然有一些错误,请按照步骤 3 进行操作。

3) 你现在必须删除“andEngine\src\main\”路径中的“jniLibs”文件夹(或者用文件夹路径代替“andEngine"在该错误中)并重新编译代码。

Error:Execution failed for task ':andEngine:transformNativeLibsWithMergeJniLibsForDebug'. More than one file was found with OS independent path 'lib/x86/libandengine.so'

感谢大家的意见/建议。

关于java - 错误 :error: '__ANDROID_API__' macro redefined [-Werror, -Wmacro-redefined] -Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45419818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com