Set NDK_MODULE_PATH for cocos2dx Android

10,954

Solution 1

In the build_native.sh file add the path of your NDK

# paths

NDK_ROOT = "E:\android-ndk-r8e-windows-x86\android-ndk-r8e"

Solution 2

Make sure that "Copy project into workspace" is unchecked before importing project into package explorer. This will resolve the error. Also make sure that you have set the environment variable named NDK_ROOT pointing at the url where you have placed the unzipped Android NDK package.

Share:
10,954
User42590
Author by

User42590

Updated on February 16, 2023

Comments

  • User42590
    User42590 about 1 year

    I am very new to cocos2dx for android.Now i install cygwin and all enviroment variables . Now when i compile and bulid my project (sample project) it gives message and error that NDK_MODULE_PATH not found . Here is my LOGCAT:

    14:26:15 **** Incremental Build of configuration Default for project HelloCpp ****
    bash C:/Workspace/HelloCpp/build_native.sh NDK_DEBUG=1 V=1 
    NDK_ROOT = C:\android-ndk-r9b
    COCOS2DX_ROOT = /cygdrive/c/Workspace/HelloCpp/../../../..
    APP_ROOT = /cygdrive/c/Workspace/HelloCpp/..
    APP_ANDROID_ROOT = /cygdrive/c/Workspace/HelloCpp
    Using prebuilt externals
    + 'C:\android-ndk-r9b/ndk-build' -C /cygdrive/c/Workspace/HelloCpp NDK_DEBUG=1 V=1 NDK_MODULE_PATH=/cygdrive/c/Workspace/HelloCpp/../../../..:/cygdrive/c/Workspace/HelloCpp/../../../../cocos2dx/platform/third_party/android/prebuilt
    make: Entering directory '/cygdrive/c/Workspace/HelloCpp'
    Android NDK: WARNING: Ignoring unknown import directory: /cygdrive/c/Workspace/HelloCpp/../../../../cocos2dx/platform/third_party/android/prebuilt    
    jni/Android.mk:19: *** Android NDK: Aborting.    .  Stop.
    Android NDK: jni/Android.mk: Cannot find module with tag 'hellocpp_shared' 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: Leaving directory '/cygdrive/c/Workspace/HelloCpp'
    

    And give error in file JNI/android.mk

    on this line :

    $(call import-module,C:\cocos2d-x-2.2;C:\cocos2d-x-2.2\cocos2dx\platform\third_party\android\prebuilt)
    

    any help will be appreciated

    UPDATED After Deleting and importing project again without copy into workspace its giving this error on run as android project after build project:

    [2013-11-18 15:30:01 - HelloCpp]     (skipping file '.gitignore' due to ANDROID_AAPT_IGNORE pattern '.*')
    [2013-11-18 15:30:01 - HelloCpp]       Unable to add 'C:\cocos2dx2\samples\Cpp\HelloCpp\proj.android\assets\fonts\Marker Felt.ttf': Zip add failed
    [2013-11-18 15:30:01 - HelloCpp] ERROR: unable to process assets while packaging 'C:\cocos2dx2\samples\Cpp\HelloCpp\proj.android\bin\resources.ap_'
    [2013-11-18 15:30:01 - HelloCpp] ERROR: packaging of 'C:\cocos2dx2\samples\Cpp\HelloCpp\proj.android\bin\resources.ap_' failed
    
  • AGPX
    AGPX over 9 years
    Thanks. This is the real answer for me.
  • Muhammad Natiq
    Muhammad Natiq over 4 years
    where the build_native.sh is located?