5

Good evening.

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

  • cocos compile -p android --android-studio
  • cocos compile -p android --android-studio
  • cocos compile -p android

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.

dwks
  • 602
  • 5
  • 10
Lovera
  • 172
  • 2
  • 15

2 Answers2

10

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.

Anand
  • 541
  • 3
  • 9
  • Also changing the gradle version in `cocos2d-x\tests\cpp-tests\proj.android-studio\gradle\wrapper\gradle-wrapper.properties` to 2.10 instead of 2.4 worked inside Android Studio. – Anand Jun 10 '16 at 12:13
  • 1
    `--app-abi armeabi` worked for me. There is an `armeabi` directory inside `cocos2d/external/freetype2/prebuilt/android`, but no `arm64` directory. – dwks Jul 04 '16 at 12:17
  • Thank. You. Been trying for hours. Logged in to up vote. – Jimmy Bouker Sep 29 '16 at 03:42
1

First of all, the commands to compile the android project starts with cocos not coconuts.

cocos compile -p android --android-studio

or

cocos compile -p android

Now, for the above error, it seems, you haven't set NDK_HOME path in environment variable. You can set it manually or goto your cocos2d-x library folder from terminal and run

./setup.py

It will do the rest.

mohakagr
  • 1,104
  • 11
  • 26
  • He had set the NDK_HOME, it's using the ndk-bundle directory from Android Studio (as you can see in the path). I've run into the same errors in OSX. Seems that cocos2d-x isn't fully compatible with the latest NDK (also a manual download from http://developer.android.com/ndk/downloads/index.html was not working). I saw it, because the build tool was looking for RELEASE.TXT which was missing in both cases. – mars3142 May 04 '16 at 06:40