【发布时间】:2017-02-27 08:05:04
【问题描述】:
我正在尝试在 Android Studio 上运行 cpp-test 示例项目,该项目包含在 cocos2d-x 3.14.1 下载中。我正在关注本教程:http://www.cocos2d-x.org/docs/installation/Android-Studio/,这需要先完成:http://www.cocos2d-x.org/docs/installation/Android-terminal/index.html。
但是,运行时出现错误
python android-build.py -p 22 cpp-tests:
我从 cmd 得到这个日志:
Android NDK: WARNING: APP_PLATFORM android-22 is larger than android:minSdkVersi
on 9 in ./AndroidManifest.xml
Android NDK: WARNING: Ignoring unknown import directory: D:\cocos2d-x-3.14.1
Android NDK: jni/Android.mk: Cannot find module with tag 'cocos' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
make: Entering directory `D:/cocos2d-x-3.14.1/tests/cpp-tests/proj.android'
jni/Android.mk:170: *** Android NDK: Aborting. . Stop.
make: Leaving directory `D:/cocos2d-x-3.14.1/tests/cpp-tests/proj.android'
Error running command, return code: 2.
Build dynamic library for project [ D:\cocos2d-x-3.14.1\build\..\tests\cpp-tests
] failed!
我尝试了另一种方法来按照 Sonar Systems 在此处的教程为 Android Studio 编译项目:https://www.youtube.com/watch?v=gdOkbXYsf04。我也遇到了同样的错误。
Android NDK: WARNING: Ignoring unknown import directory: D:\cocos2d-x-3.14.1
Android NDK: jni/Android.mk: Cannot find module with tag 'cocos' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
make: Entering directory `D:/cocos2d-x-3.14.1/tests/cpp-tests/proj.android-studi
o/app'
jni/Android.mk:170: *** Android NDK: Aborting. . Stop.
make: Leaving directory `D:/cocos2d-x-3.14.1/tests/cpp-tests/proj.android-studio
/app'
Error running command, return code: 2.
示例项目的Android.mk文件的一部分:
../../../Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp \
../../../Classes/controller.cpp \
../../../Classes/testBasic.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes \
$(LOCAL_PATH)/../../../../..
LOCAL_STATIC_LIBRARIES := cocos2dx_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,cocos)
我正在使用: 视窗 7
Android Studio 2.2.3.
Cocos2d-x 3.14.1
Python 2.7.13
蚂蚁 1.10.1
NDK r13b
请问有什么解决办法吗?
【问题讨论】:
-
抱歉这个愚蠢的问题,但我正在尝试运行一个现有的示例项目,它与链接预建库有什么关系?
-
这只是使用 cocos 的一种更简单的方法。因为您可以充分利用 Android Studio 的潜力。以调试为例。 @Kaizer Sozay 告诉你你的编译出了什么问题。
-
@Makalele ,谢谢你的建议,我会看看 :)