COCOS2DX Release Android package, configure the development environment (beginner level, a look will be)

Source: Internet
Author: User

1. Download adt-bundle-windows-x86_64 This has Eclipse and Android SDK, which is handy because the eclipse Android



The SDK path has been configured for you. (Can not find the official website to download the path on a website to write a download good)

ps:1. Note Download the time to find the corresponding version of your operating system, 32-bit -32,64-64.

2. The previous configuration of the Java environment will not be mentioned, this is to mention that Java you download 1.7, you choose the compiler in eclipse when you can choose 1.7 ago, such as 1.6, 1.5, so you understand, download JKD,

Download a little better. The compiler selection here is in eclipse, so do not control the cmd you hit java-version what appears.



Take care of the novice, popularize the NDK and Android SDK knowledge,


2. Download the NDK (Native Develop Kit), as to where to download, find out for yourself, where the download is also a primer, address or paste it out, download the corresponding version.

Why download NDK, download it why, see just the science. In short, the NDK is a bridge from language A-"B," like, How do you know love is loving, because the dictionary says that the NDK is the equivalent of this dictionary. Of course, this metaphor is not clear, presumably this means that Java and C + + through this thing can be linked. No longer a two-something irrelevant.


3. Configure the NDK path, configure the environment, pay attention to the path, which layer you get, try and figure it out for yourself.



PS: Here maybe a lot of eclipse does not have this plugin, I download this is not, then find a bar, forget from where, put here to download for everyone. This plugin is placed , and then if you open eclipse before you put it in, you need to restart eclipse.

Android NDK Plugin

4. Import your project into eclipse as the Proj.android directory. Import selection is new-"other-" android-"Android Projects from Existing Code, directory Select this directory.



PS: Remember not to choose Copy to workspace, otherwise there are many errors.

After the import, it's not finished. Don't be in a hurry to compile now. We've just configured the SDK and NDK paths, and we're using them now.

5.SDK download. We have just downloaded the SDK in the adt-bundle-windows-x86_64, but the SDK version is too many, certainly not the whole, we need the SDK may not be here. So to download the new SDK. What version of the SDK to download, decide which APK package to build is to run on what target phone. Open Sdkmanager,eclipse can be, also in the Explorer directory. You want to use which version of the Android package, it is necessary to update the corresponding SDK, such as I use 4.4 and 4.2 I have been under the two, there are so many options, afraid of what, not clear all download not on the line.

Open, SDK Manager, either from here or from Windows Resource Manager.

Download the version you need.

Configuration of the 6.SDK. Right-click Eclipse Project-"properties-" Android.



Determines which version of the Android API code your project will eventually generate.


7. Create a new ndkbuilder. The same works (right-click)-"properties-" Builders.

Take this name and configure Builder






The third picture of the configuration is not very understanding, we randomly configure it.


Here are three pictures are already very clear, no longer wordy.


Here detailed ndk_module_path to everyone to see F:\XXXX\trunk\client\cocos2d-x-2.2.3; F:\XXXX\trunk\client\cocos2d-x-2.2.3\cocos2dx\platform\third_party\android\prebuilt;

Set here. As to why this is set up here, not the top level or the lower level directory? This is actually about the Android. mk File,

In fact, look closely will know that these directories are the root directory of the NDK exists, you can use this directory as a standard, as if you take the C-disk as the same, In android.mk This file you can load the static library, you can load the CPP source file, so if you want to use both, and the path is very long, you can add the path in the Ndk_module_path. Then in the Android.mk file, based on the arbitrary path you join, fill in the relative path to find the corresponding example



These are the folders that have the Android.mk file present, the static library is loaded,



Why static libraries are so named.


The configuration of the Mk file that generated these static libraries is associated. is related to.

is the name of the library you generated with the other MK file, you use System.loadlibrary in Java ("with Cocos2dlua"); You can, load this library, the back of the _shared can add, can not add.

So we saw that when the other MK files were imported into these static libraries, the names were local_module.



Over here



is the specific CPP file, which will be compiled into your current ANDROID.MK library.




Here is the. h file, these are the static libraries you want to reference. H is located in the file, with the static library and. H You can use the functions in the library directly.

Now let's look at some other configurations.

Androidmanifest.xml


Some configuration of this file, the package is the name of the packages you want to generate, such as after you complete the game, to the online access to other channel SDK such as 360, pea pod, etc., their package has a fixed format. So here we have to change the format they need.

Note: Change the package name involves more things, must not first change here, to first such, engineering-"right-" Android tool-"Rename application package. After the change, there will be many places to error. At this point, you also need to create a new compliant package in Windows Explorer, copy the appropriate resources, and modify the error in eclipse as appropriate.

The second red box is to set your app to the lowest and target Android version, set the lowest on Android machine below this version may run the department up, while at higher than you set the Android:targetsdkversion and android: On minsdkversion machines, your app can run.

icon and label a set of your game's phone desktop icons, one is the name. Here application and activity are set up, but actually the activity is executed faster. One of these two settings is available.

Finally, remember to put your game resources in the Eclipse project's Assert folder.

Configure these your app basically doesn't have any big problems to run up. (a summary of the JNI C + + and Java intermodulation will be written later).

COCOS2DX Release Android package, configure the development environment (beginner level, a look will be)

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.