A bunch of online talk about Coco2d-x 3.0 version of the Android environment to build, it really can't bear to stare. It is unclear whether they have tested themselves or not. It's just a little time to deploy the next Android environment today.
The Cocos2d-x 3.0 version greatly simplifies the deployment of the Android environment, as simple as a single command. Okay, nonsense, don't say a word about getting to the chase. (The engine I used was the Cocos2d-x 3.0 version, and the test project was the LUA project that was created.) System for Mac)
First of all the basic andriod SDK,NDK self-reference on-line configuration. The new 3.0 requires more configuration of the ant path (which will be used at compile time) to download the configuration yourself. I have a well-configured path to refer to below. Configuring environment variables under the MAC system needs to be configured in. bash_profile. Use the command: Open. Bash_profile opens the file. If you can't find it, use: touch. Bash_profile to create it.
# Cocos2d-x
Export Develop_root=${home}/develop
Export Cocos2dx_root=${develop_root}/testlua/frameworks/cocos2d-x
Export Cocos2dx_console_root=${cocos2dx_root}/tools/cocos2d-console/console
#android
Export Android_root=${develop_root}/android
Export ANDROID_SDK_ROOT=${ANDROID_ROOT}/ADT-BUNDLE-MAC-X86_64-20140321/SDK
Export android_ndk_root=${android_root}/android-ndk-r9d
Export Android_ant_root=${android_root}/apache-ant/bin
Export Ndk_root=${android_ndk_root}
Export Ant_root=${android_ant_root}
(Testlua is the project I created)
After configuration, modify the Android.mk file to the project: Testlua/frameworks/runtime-src/proj.android/jni folder. (Do not change the words of their own Niang bar).
Then modify:. cocos-project.json file, this file under the Project testlua/folder, the Mac system is not visible by default, you need to set up to show hidden files, execute this command can display hidden files:defaults write Com.apple.finder Appleshowallfiles-bool True
Then modify the contents of the. Cocos-project.json Inside:
{
" ios_cfg ": {
" project _path ":" Frameworks/runtime-src/proj.ios_mac ",
" Project_file ":" Testlua.xcodeproj ",
"target_name": "testlua IOS"
},
"Project_type": "Lua",
"has_native": true,
"android_cfg": {
"Project_path": "Frame Works/runtime-src/proj.android "
}
}
Then copy the relevant resources to: Frameworks/runtime-src/proj.android/assets directory (resources include:testlua/src,testlua/Res and testlua/The Lua file in the Frameworks/cocos2d-x/cocos/scripting/lua-bindings/script directory).
All right, this whole environment is even configured to complete. Then start the real-machine debugging.
Use the command to go to the Testlua directory, execute: Cocos run-p Android command can be used for Android phone debugging.
Cocos2d-x 3.0 Android Environment Setup (pro-test pass)