Cocos2d-x Pack Android APK

Source: Internet
Author: User

| Copyright Notice: This article for Bo Master original article, without Bo Master permission not reproduced.

1. Download and install Android (Android) environment

See http://www.cnblogs.com/geore/p/5793620.html, follow these steps to configure the environment variables for the Apache-ant,adt and NDK.

apache-ant:http://ant.apache.org/bindownload.cgi

ndk:http://wear.techbrood.com/tools/sdk/ndk/

adt:http://www.androiddevtools.cn/

2. Download and install the JDK

Jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

After the download is complete, install the JDK. As shown in the following:

Once installed, start configuring the JDK's environment variables, such as:

(1), the system variable in the new Java_home variable, the value of the variable is:

C:\Program files\java\jdk1.8.0_05 (fill in according to your own installation path)

(2), the new system variable CLASSPATH variable, the value of the variable is:

.; %java_home%\lib;%java_home%\lib\tools.jar (Note the previous.) Don't forget it)

(3), in the system variable path variable (existing without new) Add Variable value:

%java_home%\bin;%java_home%\jre\bin (Note the value of the variable with ";" Separated

Configuration Lib\tools.jar;

Configuration Jre\bin

Configuration bin

After configuring the environment variable, press Win+r to enter CMD, and in the Black window enter Java to see if the JDK environment variable is configured successfully:

3. Start packing

(1), in the Proj.android directory of the project file in the JNI we find the android.mk file. Open it, and in the Android.mk file, add our own newly written class file. As shown in the following:

(2), and then copy the Android.mk file to the Proj.android directory under the project directory. At the same time, hold down the shift+ right mouse button in this directory and choose to open the Command window here.

(3), in the Command Window input Cocos Package apk command: Cocos compile-p Android

Such as:

Package Start:

After the package is complete, a bin\debug\android folder will be generated under the project directory, and we can find the packaged apk file in it. Such as

Cocos2d-x Pack Android APK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.