CCMenu::alignItemsVertically on Android

CCMenu::alignItemsVertically on Android
0.0 0


Can anyone confirm that CCMenu::alignItemsVertically works on Android 2.3.3? I’ve been getting crashes based on the following:

CCMenuItemImage playButton = CCMenuItemImage::itemFromNormalImage);
scoresButton = CCMenuItemImage::itemFromNormalImage(“scores-btn.png”, “scores-btn.png”, this, menu_selector(GameStartScene::scoresButtonAction));
CCMenuItemImage controlsButton = CCMenuItemImage::itemFromNormalImage);
aboutButton = CCMenuItemImage::itemFromNormalImage(“about-sm-btn.png”, “about-sm-btn.png”, this, menu_selector(GameStartScene::aboutButtonAction));

CCMenu *menu = CCMenu::menuWithItems(playButton, scoresButton, controlsButton, aboutButton, NULL);
menu~~>setPosition(ccp(size.width/2, size.height/2 + 50));
If I comment out menu~~>alignItemsVertically(); it doesn’t crash.


It should work perfectly. I’ve just run your code (but with NULL arguments for the selectors) and it worked fine. Perhaps your problem is related to the selectors (somehow)?


This only happens if you have the default configuration in for APP_STL and it’s caused by the dynamic_cast from the menu alignment method.

This particular issue was fixed by switching from

APP_STL := stlport_static


APP_STL := gnustl_static

in android/jni/

Read more about it here: