Problem with HelloWorld project on Win7 Android platform using Cocos2d-x 2.1.5 and Android NDK r9

Hi there! I’m new to cocos2d-x. I’m testing a simple HelloWorld project on both AVD and real device and everything works well, but if I change something in the HelloWorld::init() method to customize the project, when I launch the application, it shows always the default helloworld’s assets instead of my changes in the code and my assets.

Can you help me?

Can you post your code?

Yes, but I just changed the init() method in the HelloWorldScene.ccp.
Here is the code:

#include "HelloWorldScene.h"
#include "SimpleAudioEngine.h"

using namespace cocos2d;
using namespace CocosDenshion;

CCScene* HelloWorld::scene()
{
    // 'scene' is an autorelease object
    CCScene *scene = CCScene::create();

    // 'layer' is an autorelease object
    HelloWorld *layer = HelloWorld::create();

    // add layer as a child to scene
    scene->addChild(layer);

    // return the scene
    return scene;
}

// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }

    // ask director the window size
    CCSize size = CCDirector::sharedDirector()->getWinSize();

    CCSprite *bg =  CCSprite::create("moles_bg.png");
    bg->setPosition(ccp(size.width/2, size.height/2));
    this->addChild(bg, -1);

    return true;
}

void HelloWorld::menuCloseCallback(CCObject* pSender)
{
    CCDirector::sharedDirector()->end();

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    exit(0);
#endif
}

Change line 38 like this:

this->addChild(bg, 1);  // or try: this->addChild(bg, 2)

I had already tried that way but doesn’t change anything! Also in AppDelegate.ccp if I turn of the FPS with

pDirector->setDisplayStats(false);

they are still there! :frowning:

Any Ideas?

I think that, maybe, the problem is not in the code but somewhere in the project settings. I have created and setted the project step by step following different online guides.
Is there anyone who got the same problem?

On the Windows 7 (Windows Platform) works the HelloWorld version correct?
(If you want I can look deepher on your source)

Ok! Here is the project…

I tried again to recompile and customize a new HelloWorld project but I got the same result.
:frowning:
@P.E Some news?

can we skype?

Yes I can but if you want to speak in audio/video, it is not I good idea, cause my conversation skills are not so good. Also I think that this problem should be resolved publicly. So if you want help me just writing, it’s Ok! skype: sanweb82

You can write the solution here again (If we found one)

Sorry, but we still have not found the solution!

I told you some hints/improvements.
Have you tried it?
Another good startpoint to beginning programming with cocos2dx is: http://www.cocos2d-x.org/wiki/Developers_Manual .
And last but not least: Developing on Windows/Mac OSX is easier with cocos2dx
If your game is ok so you can compile it for android of course too.

Hi, I have downloaded cocos2d-x3.0alpha0 but I’m having trouble. Simply debugging the base project in Eclipse I’m getting this error: Fatal signal 11 (SIGSEGV) at 0x00003033 (code=1) ….

I got the same error with cocos2d-x 2.2.0. I don’t understand what is wrong!

Ok! Trying againg with cocos2d-x 2.2.0 and recompiling the project, all works well!:slight_smile:

Sandro Italiano wrote:

Ok! Trying againg with cocos2d-x 2.2.0 and recompiling the project, all works well!:slight_smile:

What have you done? Maybe somebody drives into the same situation.
So every hint can be a help.

I don’t know actually what was wrong! Simply, I have created and compiled a new project and so it has worked!