Search code examples
androidlinuxandroid-ndkcocos2d-x

NDK build failed cocos2d-x


This errors comes while compiling project.android in cocos2d-x:
Android NDK: WARNING: APP_PLATFORM android-16 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml make: Entering directory ``/home/maxim/project/cocos2d-x-3.5/Lesson1/proj.android' [armeabi] Compile++ thumb: cocos2dcpp_shared <= HelloWorldScene.cpp make: /home/maxim/project/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-g++: Command not found make: *** [obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o] Error 127 make: *** Waiting for unfinished jobs.... make: Leaving directory ``/home/maxim/project/cocos2d-x-3.5/Lesson1/proj.android' Ndk build failed!
What's problem?
There is my .bashrc:
export COCOS_CONSOLE_ROOT=/home/maxim/project/cocos2d-x-3.5/tools/cocos2d-console/bin export PATH=$COCOS_CONSOLE_ROOT:$PATH

export COCOS_TEMPLATES_ROOT=/home/maxim/project/cocos2d-x-3.5/templates export PATH=$COCOS_TEMPLATES_ROOT:$PATH

export NDK_ROOT=/home/maxim/project/android-ndk-r9d export PATH=$NDK_ROOT:$PATH

export ANDROID_SDK_ROOT=/home/maxim/android-sdks export PATH=$ANDROID_SDK_ROOT:$PATH export PATH=$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH

export ANT_ROOT=/usr/share/ant/bin export PATH=$ANT_ROOT:$PATH


Solution

  • Thr error pertains to a missing toolchain in your NDK folder, from the build path I can see that you are using the r9D(at the time of writing) which may not contain the 4.8v toolchain. Check the folder again and then use the following command to build via a CLI

    cocos compile -p android --ndk-toolchain arm-linux-androideabi-*
    where * will be the version of the toolchain within the NDK folder folder.