Build an Android environment for cocos on mac
Hello everyone! Please point out if there is something wrong with writing your blog for the first time! Take good care of you
About the construction of Android environment! It took me a long time to figure it out!
Install java jdk java runtime environment for the first time to build the environment, it is best to install a version 1.6! "Eclipse"
Android official downloads adt Android development tool on the Internet. After decompression, there will be two files, eclipse and sdk.
Download ndk from Android official website
I use version 3.6 of cocos, which can be downloaded from cocos's official website.
Environment variable configuration Open the terminal to enter the cocos directory (I dragged the folder directly to the terminal), execute. / setup.py, there will be a lot of prompts to follow the prompts to execute the file path required by cocos, the fire setting environment variable export ANDROID_SDK_ROOT= "here is the sdk path after you decompress the adt"
Export ANDROID_ANT_ROOT= "the path to the ant found in sdk"
Export NDK_ROOT= "the path of ndk"
Then cd ~ goes to the user's working directory and opens the file open .bash _ profile to see the contents, which are consistent with the environment variables you set.
Next, we can create a cocos project. Typing cocos new will pop up some prompts. Follow the prompt cocos new project name-p package name-d path to create a new cocos project.
When the terminal enters the path of the new cocos project, execute cocos run-p android 4 and plug in the phone to form an apk installation package on the Android device.
This article needs to be expanded. You are welcome to correct your mistakes.