为Android Studio编译cocos2d-x 3.14.1时出错:Android NDK:jni / Android.mk:在导入路径

时间:2017-02-27 08:05:04

标签: cocos2d-x cocos2d-x-3.0

我正在尝试在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!

我尝试了另一种方法来编译Android Studio的项目,遵循Sonar Systems的教程: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)

我正在使用: Windows 7

Android Studio 2.2.3。

Cocos2d-x 3.14.1

Python 2.7.13

Ant 1.10.1

NDK r13b

对此有任何解决方案吗?

1 个答案:

答案 0 :(得分:1)

嗯,好像你没有读错误

首先:

  

Android NDK:警告:忽略未知的导入目录:   d:\的cocos2d-X-3.14.1

     

Android NDK:jni / Android.mk:无法找到带有“cocos”标签的模块   导入路径

     

Android NDK:您确定您的NDK_MODULE_PATH变量是否正确   定义了吗?

     

Android NDK:搜索了以下目录:Android NDK:

您必须正确设置cocos - 运行setup.py,并确保您的Android NDK路径指向正确的目录。同样要确保ANT和Python在正确的目录中。

第二

  

Android NDK:警告:APP_PLATFORM android-22大于   android:minSdkVersi on 9 in ./AndroidManifest.xml

更改平台或最小sdk ...

如果您甚至没有阅读错误,您怎么可能解决您的问题....再见! :d