Reproduced from: http://blog.csdn.net/u010957664/article/details/60995381
Release native android application through cocos creator
Recently, I downloaded a Mahjong game client and The code of the server side, I plan to put it up and take a look. The client side needs to be previewed and released through cocos creator. I didn’t expect it took a day to get it right. My computer environment is a win7 system. Now the building steps are organized and recorded as follows:
This article mainly refers to the introductory tutorial of cocos creator
- http://www.cocos.com/docs/creator/getting-started/ index.html
1. Resource files that need to be downloaded
- cocos creatorhttp://www.cocos.com/docs/creator/getting-started/index.html
- android ndkhttp://cocostudio.download.appget.cn/Cocos/CocosStore/android-ndk-r10e-Windows.zip
- Apache Ant(Select Stable version.zip) http://ant.apache.org/bindownload.cgi
- JDK (Java is required Environment variables) http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
< li>android sdk http://cocostudio.download.appget.cn/android-sdk/android-sdk-win.zip
< li>
python(2.7.5+, but do not download python3.x version) https://www.python.org/downloads/< /p>
Note: I did not install VS2013 or VS2015 on this machine, because the platform I plan to release is android, and at the same time unzip SDK, ndk, ant to the appropriate path, and then need to reference.
2. Configure the native publishing environment path
After downloading and installing the development environment dependencies, let’s go back to Cocos Creator to configure the environment path for building and publishing the native platform. Select File/Preferences in the main menu to open the preferences window:
At this time NDK, Android SDK, ANT path, select the path decompressed in the previous step.
Note: At this time, the JavaScript engine and Cocos engine can directly select the built-in engine. It’s okay if the path is not displayed in the two text boxes. In fact, it has already selected the path. , Is in the resource directory of cocos creator.
3. Package and publish native platform
Build
Open the main menu item/build release, open the build release window.
< p style="background-color:rgb(255,255,255);">Currently, the native platforms that can be selected include Cocos Runtime, Android, iOS, Mac, and Windows. The options for publishing to Mac and Windows are only available in the corresponding operating system. Only appear in the middle.
After setting, click Build in the lower right corner, wait patiently for a while, the upper part is yellow After reading the status bar, the build is successful
Pay attention to the print statement of the cocos creator console
Compile
Continue to click Compile in the lower right corner. This time you need to wait patiently for a long time. At the same time, your computer will take up a lot of resources and become very stuck. The compilation is completed as follows
The console prints as follows
At this time, the compilation is complete, but it is not finished. At this time, select the template as binary again, and then perform the above construction and compilation process again, and it will be considered successful after completion.
At this time, it is not recommended to click to run. The official website says that you can directly debug by connecting to the real machine. I found that it does not work, but you can find the compiled apk file and open the folder where the client project is located. My project name is ddmj_20161230
Follow the path on the picture to find the apk. In fact, there is also a jsb-default directory under the build directory. There is also an apk in it, but I found that this apk cannot be used. That’s why the binary is compiled to get the correct apk file.
Students who want to view the compiled android project can open the following directory to view
p>
The above is my summary of the process of using cocos creator to publish native android applications. Welcome to learn.
Reposted from: http://blog.csdn.net/u010957664/article/details/60995381
publish native android application through cocos creator
recently downloaded a mahjong game from the Internet The code of the client and server of the client is going to be set up to take a look. The client needs to be previewed and released through cocos creator, but it took a day to get it right. My computer environment is a win7 system. Now I will organize the building steps. The record is as follows:
This article mainly refers to the introductory tutorial of cocos creator
- http://www.cocos.com/docs/creator/ getting-started/index.html
1. Resource files that need to be downloaded
- cocos creator http://www.cocos.com/docs/creator/getting-started/index.html< /li>
- android sdk h ttp://cocostudio.download.appget.cn/android-sdk/android-sdk-win.zip
- android ndkhttp ://cocostudio.download.appget.cn/Cocos/CocosStore/android-ndk-r10e-Windows.zip
- Apache Ant (choose the stable version.zip) http://ant.apache.org/bindownload.cgi
- JDK (need to be equipped with JAVA environment variables) http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
-
python(2.7.5+ , But do not download the python3.x version) https://www.python.org/downloads/
Note: I’m on this computer I did not install VS2013 or VS2015, because the platform I plan to release is android. At the same time, I will unzip the SDK, ndk, and ant to the appropriate path, and then I need to reference it.
2. Configure the native publishing environment path
After downloading and installing the development environment dependencies, let’s go back to Cocos Creator to configure the environment path for building and publishing the native platform. Select File/Preferences in the main menu to open the preferences window:
At this time NDK, Android SDK, ANT path, select the path decompressed in the previous step.
Note: At this time, the JavaScript engine and Cocos engine can directly select the built-in engine. It’s okay if the path is not displayed in the two text boxes. In fact, it has already selected the path. , Is in the resource directory of cocos creator.
3. Package and publish native platform
Build
Open the main menu item/build release, open the build release window.
< p style="background-color:rgb(255,255,255);">Currently, the native platforms that can be selected include Cocos Runtime, Android, iOS, Mac, and Windows. The options for publishing to Mac and Windows are only available in the corresponding operating system. Only appear in the middle.
After setting, click Build in the lower right corner, wait patiently for a while, the upper part is yellow After reading the status bar, the build is successful
Pay attention to the print statement of the cocos creator console
Compile
Continue to click Compile in the lower right corner. This time you need to wait patiently for a long time. At the same time, your computer will take up a lot of resources and become very stuck. The compilation is completed as follows
The console prints as follows
At this time The compilation is complete, but it is not finished. At this time, select the template as binary again, and then perform the above construction and compilation process again, and it will be considered successful after completion.
At this time, it is not recommended to click to run. The official website says that you can directly debug by connecting to the real machine. I found that it does not work, but you can find the compiled apk file and open the folder where the client project is located. My project name is ddmj_20161230
Follow the path on the picture to find the apk. In fact, there is a jsb-default directory under the build directory. There is also an apk in it, but I found that this apk cannot be used. That’s why binary is compiled to get the correct apk file.
Students who want to view the compiled android project can open the following directory to view
p>
The above is my summary of the process of using cocos creator to publish native android applications. Welcome to learn.