Can cocos2d-x continue to build and run android app using eclipse "build" instead of force using command line?

I found new cocos2d-x still cannot build android version using eclipse:

**** Build of configuration Release for project MyGame1 **** python /Users/aronho/Desktop/MyGame1/proj.android/build_native.py -b release all sh: cocos: command not found Please use cocos console instead. Traceback (most recent call last): File "/Users/aronho/Desktop/MyGame1/proj.android/build_native.py", line 43, in <module> build(opts.build_mode) File "/Users/aronho/Desktop/MyGame1/proj.android/build_native.py", line 28, in build raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!") Exception: Build dynamic library for project [ /Users/aronho/Desktop/MyGame1/proj.android/../ ] fails! **** Build Finished ****

It seems official suggestion is to use command line to build after 3.4, right?

but I want cocos2d-x to continue support building and running android app using eclipse, because I don’t want to open terminal separately when editing code in eclipse, also rebuild may be frequent during development, it is not a good experience to switch between eclipse and terminal frequently.

why not support building using eclipse?

Please go through the below post. You will able to build directly from eclipse.

1 Like

I have a solution that does not involve editing the build_native.py file.
In addition, you don’t need to do the following for each project either.

If you want Eclipse C++ build to use build_native.py correctly, within Eclipse, go to Window -> Preferences -> C/C++ -> Build -> Environment

Now, click on Add, and add the following environment variables and their corresponding values according to your work environment:

ANDROID_SDK_ROOT = path-to-android-sdk
ANT_ROOT = path-to-ant-bin
COCOS_CONSOLE_ROOT = path-to-cocos2d-console-bin
NDK_ROOT = path-to-android-ndk
NUMBER_OF_PROCESSORS = number-of-parallel-compiler-threads
PATH = ${PATH}:${ANDROID_SDK_ROOT}:${ANT_ROOT}:${COCOS_CONSOLE_ROOT}
cocos = ${COCOS_CONSOLE_ROOT}/cocos