官方下载 cocos引擎和cocos studio:http://www.cocos.com/download/
点击查看官方的 搭建Android开发环境
使用Homebrew下载python、ruby、ant等等
在cocos引擎中,下载 Cocos Framework最新版,会自带ant,并配置好相应的环境变量。
打开命令:$ open ~/.bash_profile 可以看到
COCOS_CONSOLE_ROOT
COCOS_FRAMEWORKS
ANT_ROOT
多了这三个配置,
还需要
ANDROID_SDK_ROOT # SDK 目录
NDK_ROOT # NDK 目录
或直接 进入cocos2d-x-3.9/目录 执行 ./setup.py
会看到提示需要哪些环境变量
如下:
#cocos start # Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x export COCOS_CONSOLE_ROOT=/Applications/Cocos/frameworks/cocos2d-x-3.6/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 #sdk export ANDROID_SDK_ROOT=/Users/stone/Documents/sdk export PATH=$ANDROID_SDK_ROOT:$PATH #ndk export NDK_ROOT=/Users/stone/Documents/android-ndk-r10e export PATH=$NDK_ROOT:$PATH #cocos end原文链接:https://www.f2er.com/cocos2dx/340527.html