按照版主的方法修改 依然无效
eclipse
**** Build of configuration Release for project Healer3.5 ****
python /Users/wyk/Documents/project/Healer/Healer3.5/proj.android/build_native.py -b release all
Please use cocos console instead.
COCOS_CONSOLE_ROOT not define. Please define COCOS_CONSOLE_ROOT in your environment!
**** Build Finished ****
.bash_profile
Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x
export COCOS_CONSOLE_ROOT=/Users/wyk/Documents/develop/cocos2d-x-3.5/tools/cocos2d-console/bin
export PATH=$COCOS_CONSOLE_ROOT:$PATH
Add environment variable COCOS_FRAMEWORKS for cocos2d-x
export COCOS_FRAMEWORKS=/Applications/Cocos/frameworks
export PATH=$COCOS_FRAMEWORKS:$PATH
Add environment variable ANT_ROOT for cocos2d-x
export ANT_ROOT=/Applications/Cocos/tools/ant/bin
export PATH=$ANT_ROOT:$PATH
export ANDROID_SDK_ROOT=/Users/wyk/Documents/develop/Android/adt-bundle-mac/sdk
export PATH=$ANDROID_SDK_ROOT:$PATH
export NDK_ROOT=/Users/wyk/Documents/develop/Android/android-ndk-r8d
export PATH=$NDK_ROOT:$PATH
Add environment variable COCOS_TEMPLATES_ROOT for cocos2d-x
export COCOS_TEMPLATES_ROOT=/Users/wyk/Documents/develop/cocos2d-x-3.5/templates
export PATH=$COCOS_TEMPLATES_ROOT:$PATH
build_native.py
#!/usr/bin/python
build_native.py
Build native codes
Please use cocos console instead
import sys
import os, os.path
import shutil
from optparse import OptionParser
def build(build_mode):
current_dir = os.path.dirname(os.path.realpath(__file__))
cocos_root = os.path.join(current_dir, "../cocos2d")
app_android_root = os.path.join(current_dir, "../")
if build_mode is None:
build_mode = 'debug'
elif build_mode != 'release':
build_mode = 'debug'
try: COCOS_CONSOLE_ROOT
except Exception:
print “COCOS_CONSOLE_ROOT not define. Please define COCOS_CONSOLE_ROOT in your environment!”
sys.exit(1)
command = '%s/cocos compile -p android -s %s -m s' (COCOS_CONSOLE_ROOT, app_android_root, build_mode)
command = 'cocos compile -p android -s %s -m s' (app_android_root, build_mode)
if os.system(command) != 0:
raise Exception("Build dynamic library for project " + app_android_root + " ] fails!")
-------------- main --------------
if name == ‘main’:
parser = OptionParser()
parser.add_option("-n", "--ndk", dest="ndk_build_param", help='it is not used', action="append")
parser.add_option("-p", "--platform", dest="android_platform",
help='it is not used')
parser.add_option("-b", "--build", dest="build_mode",
help='the build mode for java project,debug or release.Get more information,please refer to http://developer.android.com/tools/building/building-cmdline.html')
(opts, args) = parser.parse_args()
print "Please use cocos console instead.\n"
build(opts.build_mode)