androidandroid-ndkcocos2d-android

Cocos2d-x error while compiling LOCAL_SRC_FILES points to a missing file (and folder) Windows


Good evening.

I'm stuck trying to compile a HelloWorld using the cocos2d-x. I used the following commands:

And I always had the same answer

Android NDK: ERROR:C:\Users\santi_000\Desktop\Android\cocos2d\HelloWorld\proj.android\../cocos2d/external/freetype2/prebuilt/android/Android.mk:cocos_freetype2_static: LOCAL_SRC_FILES points to the missing file
Android NDK: Check que C:/Users/santi_000/Desktop/Android/cocos2d/HelloWorld/proj.android/../cocos2d/external/freetype2/prebuilt/android/arm64-v8a/libfreetype.a exists or que its path is correct
make: Entering directory `C: /Users/santi_000/Desktop/Android/cocos2d/HelloWorld/proj.android '
C: / Users / santi_000 / AppData / Local / Android / sdk / ndk-bundle / build //../ build / core / prebuilt-library.mk: 45: *** Android NDK: Aborting. Stop.
make: Leaving directory `C: /Users/santi_000/Desktop/Android/cocos2d/HelloWorld/proj.android '
Error running command, return code: 2.

I found some pages here in StackOverFlow however none of them helped me. I'm using Windows. I realized I do not even have the arm64-V8A folder, what do I do? Where I can copy it, or how can I generate it?

Thank you.


Solution

  • The following worked for me

    cocos compile --android-studio --target android-22 
        --ap android-22 --ndk-mode debug --ndk-toolchain arm-linux-androideabi-4.9 
        --platform android --app-abi armeabi --src C:\cocos2d-x\tests\cpp-tests
    

    You will need to replace the --ndk-toolchain to the proper one that comes with your NDK installation. Check in the toolchains folder inside NDK_ROOT.

    The most important one that actually got it working was --app-abi armeabi as that is what was the toolchain used.

    [Edit] If you actually check cocos compile -h you will see that --app-abi mentions armeabi as the default. But that is not the case. It is picking up arm64 as the default.