I only have Android device, no Apple, can't test, don't say how to transplant to Apple. Limited capacity, please forgive me
Adjust screen fit First
Modify the AppDelegate.cpp file
Glview->setframesize (800, 480), removed, not required on the real machine, screen size already has
Modified to Resolutionpolicy::exact_fit: ensures that the design area is fully covered, but image stretching may occur
Glview->setdesignresolutionsize (480, Resolutionpolicy::exact_fit);
1. Import Project to eclipse
Open Eclipse and select File->new->other->android/android Project from Existing Code when you create a new project. Select the proj.android mentioned in the previous step to import the project into eclipse.
2. Set up project configuration information
(1) On the project Point "Properties"-android-project build Target Select the corresponding Android version, mine is android4.4
(2) Right-click->build path->config Build Path, under source can see libcocos2d path is wrong, in the middle of a "2d". Change it back to the correct path.
3, solve the Android project library loading
Copy the COCOS2DX library file, under the source directory cocos2d\cocos\platform\android\java\src, copy the org directory file into the PROJ.ANDROID\SRC directory
4. Modify jni/android.mk files and application.mk files
To add a CPP file that needs to be compiled in ANDROID.MK
Local_path: = $ (call My-dir) include $ (clear_vars) $ (call import-add-path,$ (Local_path)/. /.. /COCOS2D) $ (call import-add-path,$ (Local_path)/... /.. /cocos2d/external) $ (call import-add-path,$ (Local_path)/... /.. /cocos2d/cocos) Local_module: = cocos2dcpp_sharedlocal_module_filename: = libcocos2dcpplocal_src_files: = hellocpp/ Main.cpp. /.. /classes/appdelegate.cpp. /.. /classes/gamebasescene.cpp. /.. /classes/item.cpp. /.. /classes/item_ball.cpp. /.. /classes/item_crab.cpp. /.. /classes/item_emergency.cpp. /.. /classes/item_fog.cpp. /.. /classes/item_strength_up.cpp. /.. /classes/item_stretcher.cpp. /.. /classes/languagestring.cpp. /.. /classes/lotterycard.cpp. /.. /classes/mapchoosescene.cpp. /.. /classes/menuscene.cpp. /.. /classes/richergamecontroller.cpp. /.. /classes/richerplayer.cpp. /.. /classes/routenavigation.cpp. /.. /classes/seascene.cpp. /.. /classes/splashscene.cpp. /.. /classes/util.cpp. /.. /classes/popuplayEr/cocostoast.cpp. /.. /classes/popuplayer/popuplayer.cpp. /.. /classes/skill/skillcard.cpp. /.. /classes/stock/linechart.cpp. /.. /classes/stock/stock.cpp. /.. /classes/stock/stockcellcard.cpp. /.. /classes/stock/visiblerect.cpp. /.. /classes/lottery/ellipseby.cpplocal_c_includes: = $ (Local_path)/. /.. /classes $ (local_path)/. /.. /classes/popuplayer $ (local_path)/. /.. /classes/skill $ (local_path)/. /.. /classes/stock $ (local_path)/. /.. /classes/lottery local_whole_static_libraries: = cocos2dx_staticlocal_whole_static_libraries + = Cocosdenshion_ Static # Local_whole_static_libraries + box2d_static# local_whole_static_libraries + = cocosbuilder_static# LOCAL_ Whole_static_libraries + = spine_static# local_whole_static_libraries + cocostudio_static# LOCAL_WHOLE_STATIC_ LIBRARIES + = cocos_network_static local_whole_static_libraries + cocos_extension_staticinclude $ (BUILD_SHARED_ LIBRARY) $ (call Import-module,.) $ (call import-module,audio/android) # $ (Call Import-module,boX2D) # $ (call Import-module,editor-support/cocosbuilder) # $ (call Import-module,editor-support/spine) # $ (call Import-module,editor-support/cocostudio) # $ (call Import-module,network) $ (call import-module,extensions)
Modify the Application.mk file, App_abi: = Armeabi x86,
This makes it possible to compile and build x86 and arm platform-related so files
5. Enter the cmd command prompt, compile and build the. so file
Note that the NDK environment variables should be configured first.
Run richer\proj.android>build_native.py to start compiling or run Cocos compile-p Android compilation at Richer
A cocos-ext.h error occurred at compile time and could not be found
Modify to #include "extensions/cocos-ext.h"
6. Refresh in eclipse, generate APK install package, test run
Project Right button "Android Tools"-"Export signed Application Package ..."-"Project Checks" Fill richer--"Create New KeyStore"
Save the signature file as Richer.key, enter the next step after completing the password
Key creation, complete the next step
Fill in the directory where you want to generate the APK and click Finish.
This will allow you to install the APK test.
7. Other questions:
(1) After you import an Android project after opening eclipse, exit and then open and sometimes encounter a java.lang.NullPointerException error.
File under Proj.android ". Cproject" Delete
(2) cannot find a variable such as float int, the test discovery is due to comments, there may be an inappropriate character in the comments or the encoding format is not the result of
You can just remove the comment.
such as LineChart.h
The following comments in the file are removed, if not removed, always reported that these variables are not defined
float Spaceratio; Y-Axis spacing factor
float Leftratiox; X-axis left-side spacing factor
int maxValue1; The maximum value in the data
float layerHeight1; The distance from the bottom of the figure
APK download: Click to download APK
Code download: Click to download
Not to be continued ..........
Cocos2d-x 3.2 Monopoly Game project Development-Part 30th project porting