Today it's OK to try the next 3.0 official version of the Android platform for the transplant, the new project was transplanted under. The process only takes about 10 minutes, what concept?!
Well, actually I would like to say that this version number is really very easy to transplant, but it has not added anything else, just for the moment, it is really very convenient. Psychology is a bit more balanced, because writing code is always thinking to remove cc ...
Don't say much, let's see how to transplant to the Android platform. Experience what is called convenience.
The first thing that needs Android Ndk,sdk,eclipse is not to mention it. These have been transplant experience is not much to say, about the NDK, it is best to go to the official website to download the latest version number.
Suppose you have a new class file of your own. Remember in the "\testgame\proj.android\jni" folder under "Android.mk" to add, here I built a project, no matter what changes, so I do not have to join.
Open cmd and go to the Android solution folder. That is "\cocos2d-x-3.0\projects\testgame\proj.android", you will see a "build_native.py" file under this folder. OK, we just need it. And the very image that was compiled with Cygwin,
Enter build_native.py. Enter, start compiling, very easy.
Seeing the diagram above shows that the compilation was successful. A. So file is generated.
Go back to the \cocos2d-x-3.0\projects\testgame\cocos2d\cocos\2d\platform\android\java\src folder, Copy and paste the Org folder into the src file under the Android project (path \TESTGAME\PROJ.ANDROID\SRC), which must be done for each migration. Not much to explain.
Finally, you open Eclipse, import the project, and execute it.
Assuming this error is encountered
[2014-04-26 12:31:48-dex Loader] Unable to execute dex:java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[2014-04-26 12:31:48-testgame] Conversion to Dalvik format failed:unable to execute dex:java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
Remove the "Android Dependencies" to get rid of it.
Run as again, you can see such a very nostalgic image in the simulator.
In fact, we can open the "build_native.py" file and read the Python script. For example, this is copying resources. Therefore, we do not need to copy resources under the resource folder.
def copy_resources (app_android_root): # Remove App_android_root/assets if it exists Assets_dir = Os.path.join ( App_android_root, "assets") if Os.path.isdir (assets_dir): shutil.rmtree (Assets_dir) # Copy Resources Os.mkdir (assets_dir) Resources_dir = Os.path.join (App_android_root, "... /resources ") if Os.path.isdir (resources_dir): copy_files (Resources_dir, Assets_dir)
Suppose there is no ndk found. SDK, configure the path is good.
Cocos2d-x v3.0 Official edition of "2" Android platform porting