First, create a project that can run both in Xcode and Eclipse:
1.
Open the Mac terminal, enter the Tools/project-creator in the Cocos2d-x directory, execute the command
./create_project.py-project [Project name]-package [package name]-language [using the language CPP or Java, etc.]
You can then see the newly generated project in the projects in the Cocos2d-x directory.
2. Place the created item in the D:\cocos2d\cocos2d-x-2.1.4\projects directory, if no Projects folder can create a
3. Import Android Project Proj.android
4. Import the Cocos2d-x library file D:\cocos2d\cocos2d-x-2.1.4\cocos2dx\platform\android\java\src the file into the project src directory, refresh the project to see the imported package.
5. Select the SDK for the corresponding device: Select the item, right-select Properties->android, select the SDK version OK to save.
6. The corresponding version information in the Androidmanifest.xml
7. Set environment variable Ndk_module_path: = d:\cocos2d\cocos2d-x-2.1.4;d:\cocos2d\cocos2d-x-2.1.4\cocos2dx\platform\third_party\ Android\prebuilt
8. Set Tool Chain editor:current toolchain = No toolchain; Current builder = Android Builder
9. Jni folder, add:
Windows under
Ndk_module_path: = d:\cocos2d\cocos2d-x-2.1.4;d:\cocos2d\cocos2d-x-2.1.4\cocos2dx\platform\third_party\android\ prebuilt
App_cflags + =-wno-error=format-security
Mac under
Ndk_module_path: =/users/eachbaby3/documents/cocos2d-x/cocos2d-x-2.1.4;/users/eachbaby3/documents/cocos2d-x/ Cocos2d-x-2.1.4/cocos2dx/platform/third_party/android/prebuilt
App_cflags + =-wno-error=format-security
To Application.mk
10. Import the resources from the project resource bundle into the Assets folder and refresh it.
Ii. porting projects completed from Xcode to eclipse (same as above 2-10 steps)
1. Modify the Android.mk file
Add cocos2d Path
$ (call import-add-path,$ (Local_path)/platform/third_party/android/prebuilt)
$ (call Import-add-path,/users/eachbaby3/documents/cocos2d-x/cocos2d-x-2.1.4) \
$ (Call Import-add-path,/users/eachbaby3/documents/cocos2d-x/cocos2d-x-2.1.4/cocos2dx/platform/third_party/ Android/prebuilt) \
My_cpp_list: = $ (wildcard $ (local_path)/*.cpp)
My_cpp_list + = $ (wildcard $ (local_path)/hellocpp/*.cpp)
My_cpp_list + = $ (wildcard $ (local_path)/.. /.. /classes/*.cpp)
Local_src_files: = $ (my_cpp_list:$ (Local_path)/%=%)
2. Modify the main class name of the makefile file
3. Select the General->code analysis mode for use project settings, cancel all selected bugs
Zoom in from 1024 to 960 times 0.9375