Cocos2d-x, TileMap and Android issue

Cocos2d-x, TileMap and Android issue
0.0 0



I try to use Cocos2d-X with TileMap for Android/iOS development with this tutorial (

If I run this example in iOS emulator (iPad) all work correctly ,but if I run on Android (Galaxy S 2 or Galaxy Tab 10.1 ) I see some artifacts: - Galaxy S 2, Android 4.0.4 - Galaxy Tab 10.1 Android 4.1.2, Tegra2

I think, this is due to loss of precision in Android version Cocos2D-x.


Hi, well I had the same problem, for android need change this file CCTMXXMLParser.cpp in line 456 you will find:

tileset~~>m_sSourceImage = m_sResources + “/” + imagename;
Change for this:
tileset~~>m_sSourceImage = m_sResources + “/” + imagename;
tileset->m_sSourceImage = imagename;

The problem is by the slash (/)

Try and response if you have some other problem.

Good luck.



thank you for help!

I use Cocos2D-x 2.0.3 and in my case this line is

tileset->m_sSourceImage = m_sResources + (m_sResources.size() ? "/" : "") + imagename;

If I change this code to

if( m_sResources!=“” ) {
tileset~~>m_sSourceImage = m_sResources + “/” + imagename;
else {
tileset~~>m_sSourceImage = imagename;

it has no effect for me.


Oh well really I’m not sure in my case the TMX in android works fine. Could you reload the pictures? I try to help you if I can =D


Hi, today I tested this app on real iPad 2 and I got some results. :slight_smile: This not only android issue.

New pictures: Galaxy S II (Android 4.0.4) Galaxy Tab 10.1 (Android 4.1.2) - iPad 3 (iOS 5.1.1) - iPad Emulator (iOS 6.0) It has no issue.


Ahhhhh yes I remember that to fix find the file ccConfig.h in directory cocos2dx/include/ccConfig.h find this line:


And add 1 to the end:


Here talk about this solutions.


Thank you! It works!


Great man =D if you have other problem I will pleasure to help you.