Cocos2dx releases the Android package and configures the development environment (getting started at the cainiao level) and cocos2dxandroid
1. Download adt-bundle-windows-x86_64 here there are Eclipse and Android SDK, this is very convenient, because Eclipse Android
The SDK path has been configured for you. (If you cannot find the download path from the official website, you can write the download path on a website)
PS: 1. When downloading, find the version corresponding to your operating system, 32-32, 64-64.
2. I will not go into details about the previous configuration of the Java environment. Here, we mention that you can download Java 1.7. When you select the compiler in Eclipse, you can select 1.7 before, for example, 1.6, 1.5, so you know, when downloading JKD,
Download a little higher. The compiler here is made in Eclipse, so don't worry about what happens when you press Java-version in cmd.
Take care of new users and popularize knowledge about NDK and Android SDK,
2. Download The NDK (Native Develop Kit). As for where to download it, find it and find it. It is also an entry-level download method. paste the address and download the corresponding version.
Why download NDK? Why? Let's take a look at the popular science just now. In short, NDK is A bridge from language A-B, just like, how do you know that Love is Love? Because it is written in the dictionary, this NDK is equivalent to this dictionary. Of course, this metaphor is not clear. It means that Java and C ++ can be connected through this. It is no longer irrelevant.
3. Configure the NDK path. When configuring the environment, pay attention to the path, which layer do you get, and try and figure it out by yourself.
PS: there may be a lot of Eclipse plug-ins that I don't have. If I don't have this plug-in, I just need to find one. I forgot where it came from and put it here for you to download. This plug-in is put, and if you open Eclipse before you put it in, you need to restart Eclipse.
Android NDK plugin
4. Import your project as the proj. android directory to Eclipse. Choose New-other-Android Projects From Existing Code for the import. Select the directory.
PS: do not select copy to workspace. Otherwise, there are many errors.
After the import, it is not complete. Do not rush to compile now. We have just configured the SDK and NDK paths, and now we use them.
5. Download the SDK. The adt-bundle-windows-x86_64 we downloaded just now has the SDK, but the SDK version is too many, certainly not all, we need the SDK may not be here. Download the new SDK. The version of the SDK to be downloaded determines the target mobile phone number of the apk package to be generated. Open SDKManager, Eclipse, and resource manager. If you want to use the Android package of which version you want to generate, you need to update the corresponding SDK. For example, if I use Android 4.4 and Android 4.2, I will release these two. There are so many options in them, so what are you afraid, if you don't know, you just need to download it.
Open, SDK Manager, from here or from Windows resource management.
Download the required version.
6. Configure the SDK. Right-click Eclipse project-> properties-> Android.
Determines which version of Android API code will be generated for your project.
7. Create an NDKBUilder. The same project (right-click)-> properties-> Builders.
Configure the Builder.
The configuration of the third Shard is hard to understand.
The three figures here are clear, so they are no longer long-winded.
Here the detailed NDK_MODULE_PATH for 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. Why should we set this here, instead of the top or bottom level directories? In fact, this is related to the Android. mk file,
In fact, you will know that these directories exist as the root directory of the NDK, that is, you can take this directory as the standard, as if you take disk C as the standard, in Android. you can load static libraries and Cpp source files in the mk file. Therefore, if you want to use both files and have a long path, you can add a path to NDK_MODULE_PATH. Then, in the Android. mk file, based on the arbitrary paths you add, fill in the relative paths to find the corresponding
These are all folders with Android. mk files and are loaded with static libraries,
Why is the static library named like this.
The configuration is associated with the mk file that generates these static databases. Yes.
Is the name of the library generated by using other mk files. You use system in java. loadLibrary ("use cocos2dlua"); you can load the library. The _ shared file can be added later, but not added.
So we can see that when other mk files import these static libraries, the name is based on LOCAL_MODULE.
Here
It is the specific Cpp file, which should be compiled into your current Android. mk library.
Here is the. h file, which is the static library you want to reference. The file where h is located has a static library and. H, you can directly use the functions in the library.
Now let's look at some other configurations.
AndroidManifest. xml
Some configurations of this file. package is the package name you want to generate. For example, after you finish the game, you need to go online to access other channels for sdks, such as 360 and pods. Their packages are in a fixed format. So here we need to change to the format they need.
Note: Changing the Package name involves a lot of things. Do not change the Package name here first. In this case, right-click Project> Android Tool> Rename Application Package. After the change, there will be many errors. In this case, you need to create a new compliant package in Windows Resource Manager, copy the corresponding resource, and modify it in Eclipse based on the error.
In the second red box, you need to set the minimum and target Android versions of your app. If you set the minimum value, you may need to run the app on an Android machine earlier than this version, on android: targetSdkVersion and android: minSdkVersion, your applications can run.
An icon and a label set the desktop icon of your game's mobile phone, and a name. The Application and Activity are both set here, while the Activity is actually executed faster. You can set one of these two parts.
Remember to put your game Resources in the assert folder of the eclipse project.
After configuring these applications, you can run them without any major problems. (I will write a summary about the interaction between JNI C ++ and Java ).