Android NDK: jni/Android.mk: Cannot find module with tag ‘cocos’ in import path

Android NDK: jni/Android.mk: Cannot find module with tag ‘cocos’ in import path
0.0 0

#1

I’m trying to run cpp-test project on Android Studio. I’m following this tutorial : http://www.cocos2d-x.org/docs/installation/Android-Studio/, which requires complete this first: http://www.cocos2d-x.org/docs/installation/Android-terminal/index.html.

However, I got error when run
python android-build.py -p 22 cpp-tests:

I got this log from cmd :


Building native...
NDK build mode: debug
running: '"C:\Users\ToanTM\AppData\Local\Android\sdk\ndk-bundle\ndk-build" -C D:
\cocos2d-x-3.14.1\tests\cpp-tests\proj.android -j4 APP_ABI="armeabi-v7a" NDK_MOD
ULE_PATH=D:\cocos2d-x-3.14.1;D:\cocos2d-x-3.14.1\cocos;D:\cocos2d-x-3.14.1\exter
nal NDK_TOOLCHAIN_VERSION=4.9 NDK_DEBUG=1'

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!

I tried another way to compile the project for Android Studio following Sonar Systems’s tutorial here: https://www.youtube.com/watch?v=gdOkbXYsf04 with this command cocos compile -p android --android-studio -- ap android-19. But still the same error:


Building native...
NDK build mode: debug
running: '"C:\Users\ToanTM\AppData\Local\Android\sdk\ndk-bundle\ndk-build" -C D:
\cocos2d-x-3.14.1\tests\cpp-tests\proj.android-studio\app -j4 NDK_MODULE_PATH=D:
\cocos2d-x-3.14.1;D:\cocos2d-x-3.14.1\cocos;D:\cocos2d-x-3.14.1\external NDK_TOO
LCHAIN_VERSION=4.9 NDK_DEBUG=1'

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.

I’m using:
Windows 7
Android Studio 2.2.3.
Cocos2d-x 3.14.1
Python 2.7.13
Ant 1.10.1
NDK r13b
Any solution for this please?


#2

What does your Android.mk look like?


#3

@slackmoehrle Hi, sorry for the lack of information. I’m trying to run the cpp-tests sample project packed with the cocos2d-x 3.14.1 on Android Studio. Here is the Android.mk of proj.android-studio:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := cpp_tests_shared

LOCAL_MODULE_FILENAME := libcpp_tests

LOCAL_ARM_MODE := arm

LOCAL_SRC_FILES := main.cpp \
../../../Classes/ActionManagerTest/ActionManagerTest.cpp \
../../../Classes/ActionsEaseTest/ActionsEaseTest.cpp \
../../../Classes/ActionsProgressTest/ActionsProgressTest.cpp \
../../../Classes/ActionsTest/ActionsTest.cpp \
../../../Classes/AllocatorTest/AllocatorTest.cpp \
../../../Classes/AppDelegate.cpp \
../../../Classes/BaseTest.cpp \
../../../Classes/BillBoardTest/BillBoardTest.cpp \
../../../Classes/Box2DTest/Box2dTest.cpp \
../../../Classes/Box2DTestBed/Box2dView.cpp \
../../../Classes/Box2DTestBed/GLES-Render.cpp \
../../../Classes/Box2DTestBed/Test.cpp \
../../../Classes/Box2DTestBed/TestEntries.cpp \
../../../Classes/BugsTest/Bug-CCDrawNode.cpp \
../../../Classes/BugsTest/Bug-1159.cpp \
../../../Classes/BugsTest/Bug-1174.cpp \
../../../Classes/BugsTest/Bug-350.cpp \
../../../Classes/BugsTest/Bug-422.cpp \
../../../Classes/BugsTest/Bug-458/Bug-458.cpp \
../../../Classes/BugsTest/Bug-458/QuestionContainerSprite.cpp \
../../../Classes/BugsTest/Bug-624.cpp \
../../../Classes/BugsTest/Bug-886.cpp \
../../../Classes/BugsTest/Bug-899.cpp \
../../../Classes/BugsTest/Bug-914.cpp \
../../../Classes/BugsTest/Bug-12847.cpp \
../../../Classes/BugsTest/Bug-15594.cpp \
../../../Classes/BugsTest/Bug-15776.cpp \
../../../Classes/BugsTest/Bug-Child.cpp \
../../../Classes/BugsTest/BugsTest.cpp \
../../../Classes/Camera3DTest/Camera3DTest.cpp \
../../../Classes/ChipmunkTest/ChipmunkTest.cpp \
../../../Classes/ClickAndMoveTest/ClickAndMoveTest.cpp \
../../../Classes/ClippingNodeTest/ClippingNodeTest.cpp \
../../../Classes/CocosDenshionTest/CocosDenshionTest.cpp \
../../../Classes/ConfigurationTest/ConfigurationTest.cpp \
../../../Classes/ConsoleTest/ConsoleTest.cpp \
../../../Classes/CurlTest/CurlTest.cpp \
../../../Classes/CurrentLanguageTest/CurrentLanguageTest.cpp \
../../../Classes/DataVisitorTest/DataVisitorTest.cpp \
../../../Classes/DownloaderTest/DownloaderTest.cpp \
../../../Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp \
../../../Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp \
../../../Classes/EffectsTest/EffectsTest.cpp \
../../../Classes/ExtensionsTest/AssetsManagerExTest/AssetsManagerExTest.cpp \
../../../Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp \
../../../Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp \
../../../Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp \
../../../Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp \
../../../Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.cpp \
../../../Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp \
../../../Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp \
../../../Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp \
../../../Classes/ExtensionsTest/ControlExtensionTest/CCControlColourPicker/CCControlColourPickerTest.cpp \
../../../Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp \
../../../Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp \
../../../Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp \
../../../Classes/ExtensionsTest/ControlExtensionTest/CCControlSliderTest/CCControlSliderTest.cpp \
../../../Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp \
../../../Classes/ExtensionsTest/ControlExtensionTest/CCControlSwitchTest/CCControlSwitchTest.cpp \
../../../Classes/ExtensionsTest/ExtensionsTest.cpp \
../../../Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp \
../../../Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp \
../../../Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp \
../../../Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp \
../../../Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp \
../../../Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp \
../../../Classes/FileUtilsTest/FileUtilsTest.cpp \
../../../Classes/FontTest/FontTest.cpp \
../../../Classes/InputTest/MouseTest.cpp \
../../../Classes/IntervalTest/IntervalTest.cpp \
../../../Classes/JNITest/JNITest.cpp \
../../../Classes/LabelTest/LabelTest.cpp \
../../../Classes/LabelTest/LabelTestNew.cpp \
../../../Classes/LayerTest/LayerTest.cpp \
../../../Classes/LightTest/LightTest.cpp \
../../../Classes/MaterialSystemTest/MaterialSystemTest.cpp \
../../../Classes/MenuTest/MenuTest.cpp \
../../../Classes/MotionStreakTest/MotionStreakTest.cpp \
../../../Classes/MutiTouchTest/MutiTouchTest.cpp \
../../../Classes/NewAudioEngineTest/NewAudioEngineTest.cpp \
../../../Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp \
../../../Classes/NewRendererTest/NewRendererTest.cpp \
../../../Classes/NavMeshTest/NavMeshTest.cpp \
../../../Classes/NodeTest/NodeTest.cpp \
../../../Classes/OpenURLTest/OpenURLTest.cpp \
../../../Classes/ParallaxTest/ParallaxTest.cpp \
../../../Classes/Particle3DTest/Particle3DTest.cpp \
../../../Classes/ParticleTest/ParticleTest.cpp \
../../../Classes/PhysicsTest/PhysicsTest.cpp \
../../../Classes/Physics3DTest/Physics3DTest.cpp \
../../../Classes/ReleasePoolTest/ReleasePoolTest.cpp \
../../../Classes/RenderTextureTest/RenderTextureTest.cpp \
../../../Classes/RotateWorldTest/RotateWorldTest.cpp \
../../../Classes/SceneTest/SceneTest.cpp \
../../../Classes/SchedulerTest/SchedulerTest.cpp \
../../../Classes/ShaderTest/ShaderTest.cpp \
../../../Classes/ShaderTest/ShaderTest2.cpp \
../../../Classes/SpineTest/SpineTest.cpp \
../../../Classes/Scene3DTest/Scene3DTest.cpp \
../../../Classes/Sprite3DTest/DrawNode3D.cpp \
../../../Classes/Sprite3DTest/Sprite3DTest.cpp \
../../../Classes/SpritePolygonTest/SpritePolygonTest.cpp \
../../../Classes/SpriteTest/SpriteTest.cpp \
../../../Classes/TerrainTest/TerrainTest.cpp \
../../../Classes/TextInputTest/TextInputTest.cpp \
../../../Classes/Texture2dTest/Texture2dTest.cpp \
../../../Classes/TextureCacheTest/TextureCacheTest.cpp \
../../../Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp \
../../../Classes/TileMapTest/TileMapTest.cpp \
../../../Classes/TileMapTest/TileMapTest2.cpp \
../../../Classes/TouchesTest/Ball.cpp \
../../../Classes/TouchesTest/Paddle.cpp \
../../../Classes/TouchesTest/TouchesTest.cpp \
../../../Classes/TransitionsTest/TransitionsTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIScene.cpp \
../../../Classes/UITest/CocoStudioGUITest/UISceneManager.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIWebViewTest/UIWebViewTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UIWidgetAddNodeTest/UIWidgetAddNodeTest.cpp \
../../../Classes/UITest/CocoStudioGUITest/UITabControlTest/UITabControlTest.cpp \
../../../Classes/UITest/UITest.cpp \
../../../Classes/UnitTest/RefPtrTest.cpp \
../../../Classes/UnitTest/UnitTest.cpp \
../../../Classes/UserDefaultTest/UserDefaultTest.cpp \
../../../Classes/VisibleRect.cpp \
../../../Classes/VibrateTest/VibrateTest.cpp \
../../../Classes/VRTest/VRTest.cpp \
../../../Classes/ZwoptexTest/ZwoptexTest.cpp \
../../../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)

#4

Finally, I fixed it by uninstall everything, delete all Environment Variable and set it all up from the beginning for 3 or 4 times. I also move cocos2d-x 3.14.1 to another folder( from D:\cocos2d-x 3.14.1 to D:\cocos2d-x\cocos2d-x 3.14.1).

And that fixed it, I still have no idea why but I’m pretty sure everything is the same.


#5

Hi!
I have a similar problem. It works with version 3.13.1 and the same problem with 3.14.1+ (github).
Could you say what exactly you are have reinstalled?


#6

I reverse everything to the begining by:

  • Deleting the cocos2d-x 3.14.1 folder. Download it again, unzip and put it into another folder likes I said above.
  • Deleting all the evironment variables created by the setup.py : ANDROID_SDK_ROOT, ANT_ROOT, COCOS_CONSOLE_ROOT, COCOS_TEMPLATE_ROOT, COCOS_X_ROOT, NDK_ROOT.
  • Removing their path in the PATH varible , which is :C:\Python27;D:\apache-ant-1.10.1\bin and D:\cocos2d-x\cocos2d-x-3.14.1\templates;D:\cocos2d-x\cocos2d-x-3.14.1\tools\cocos2d-console\bin in my PC.
  • Restart my PC ( I saw some guide said that it’s neccessary to restart the computer after environment variable change)

Then I following all the step here : http://www.cocos2d-x.org/docs/installation/Android-terminal/index.html . Make sure you do it step by step and check whether the ant and python command works in command line. Take note that the path to ANT_ROOT should be D:\apache-ant-1.10.1\bin instead of D:\apache-ant-1.10.1 (replace the path to apache with your corresponding path). And restart your PC after setting up your environment variables with setup.py with all correct path.

I don’t know how this work for me but it’s worth a try :slight_smile:


#7

I recently rewrote these instructions but they have not been deployed because I need to do a final test on Windows. I will deploy they soon. Those that I asked said the new version was way better to comprehend.


#8

Oh great to hear that. It would be much easier for newcomer like me to get used to cocos2d-x :smiley: . Looking forward to hearing the good news from you :slight_smile:


#9

Thank you very much for your response!

But I do not think that the problem in Environment variables. I can work with version 3.13.1 in Visual Studio and Eclipse.
I thought that the reason may be in conflict of versions of JDK, SDK, NDK… or cocos 3.14.1.

Now I think that the problem in 3.14.1+ from github.
I will try the latest version tomorrow and will tell you about the results.


#10

Better late than never.

3.14.1 works
3.14.1+ (latest from github) does not works

C:\Windows\system32>cocos compile -p android --ap android-19 -s D:\cc2dTEST
Building mode: debug
Using Eclipse project : D:\cc2dTEST\proj.android
running: '"D:\android-sdk\tools\android" update project -t android-19 -p D:\cc2dTEST\proj.android'

Updated project.properties
Updated local.properties
Updated file D:\cc2dTEST\proj.android\proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
running: '"D:\android-sdk\tools\android" update lib-project -p D:\cc2dTEST\cocos2d\cocos\platform\android\java -t android-19'

Updated project.properties
Updated local.properties
Updated file D:\cc2dTEST\cocos2d\cocos\platform\android\java\proguard-project.txt
Building native...
NDK build mode: debug
running: '"D:\android-ndk-r13b\ndk-build" -C D:\cc2dTEST\proj.android -j4 NDK_MODULE_PATH=D:\cc2dTEST\cocos2d;D:\cc2dTEST\cocos2d\cocos;D:\cc2dTEST\cocos2d\external NDK_TOOLCHAIN_VERSION=4.9 NDK_DEBUG=1'

Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
Android NDK: D:/android-ndk-r13b/build//../sources/android/cpufeatures/Android.mk: Cannot find module with tag 'freetype2/prebuilt/android' 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:/cc2dTEST/proj.android'
D:\cc2dTEST\cocos2d\cocos/./Android.mk:312: *** Android NDK: Aborting.    .  Stop.
make: Leaving directory `D:/cc2dTEST/proj.android'
Error running command, return code: 2.

Visual Studio also can not open the win32 project correctly.
It looks like there are missing some libraries or something.

@slackmoehrle Can someone from the team look at this, please?


#11

What branch in GitHub did you clone? Try v3 if you didn’t use that branch.


#12

I used v3 branch.

I also noticed that download-deps.py does not ask me any more if I want to save the zip file or not.
And the creation of a new project seems to be faster than usual.


#13

Are you using the pre-compiled libraries?


#14

No, I do not.

I am using

cocos new cc2dTEST -p com.cc2dtest -l cpp -d D:\

then

cocos compile -p android --ap android-19 -s D:\cc2dTEST

or trying to open in Visual Studio.


#15

@slackmoehrle

Any ideas? Should I create an issue for this?


#16

Please do, post the issue URL and I will ask the engineering team to take a look


#17

I reinstalled the system and tried branch 3.15 today, the same problem.

I wll go create an issue on the github.


#18

@slackmoehrle

The issue created

I’m sorry that it’s so late.


#19

I wonder if someone can confirm this.

I apologize for using @sinhviencodon 's topic, but it seemed to me that his problem was caused by the fact that the first time he downloaded the latest version as I did, and then used the 3.14 tag for downloading and everything was fine. Just my guess though.

@slackmoehrle Help please!
I planned release on next week. And I really need a fresh version with the fixed audio engine.


#20

3.15 is a development branch. I wouldn’t try and use this branch for anything more than testing. It isn’t production certified yet.