Launching Cocos2d-x HelloWorld Screen No Matter what (Android)

Launching Cocos2d-x HelloWorld Screen No Matter what (Android)
0.0 0


I just installed Cocos2d-x on my WIndows 7 OS with Eclipse IDE for Android. But strange things happening. Whatever I change my code in the “HelloWorldScene.cpp” file, everytime I get is HelloWorld Screen which comes up with Cocos2d-x on my Android Device(2.3.6). What I tried to do is to Clean Project,delete app from my Android Device, launch and install again but nothing. I still getting what HelloWorld Screen. This is my “HelloWorldScene.cpp” file:

#include "HelloWorldScene.h"


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

    // 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");

    float rX = size.width / bg->getContentSize().width;
    float rY = size.height / bg->getContentSize().height;


    return true;

void HelloWorld::menuCloseCallback(CCObject* pSender)


This is my “AppDelegate.cpp” file:

#include "AppDelegate.h"
#include "HelloWorldScene.h"


AppDelegate::AppDelegate() {



bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();


    // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
    // pDirector->enableRetinaDisplay(true);

    // turn on display FPS

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);

    // create a scene. it's an autorelease object
    CCScene *pScene = HelloWorld::scene();

    // run

    return true;

// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() {

    // if you use SimpleAudioEngine, it must be pause
    // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {

    // if you use SimpleAudioEngine, it must resume here
    // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();

All assets is in my “Assets” folder.

This is what my LogCat saying:

09-13 14:59:38.765: D/dalvikvm(12292): Trying to load lib /data/data/com.cococs.andgame/lib/ 0x40515f88
09-13 14:59:38.789: D/dalvikvm(12292): Added shared lib /data/data/com.cococs.andgame/lib/ 0x40515f88
09-13 14:59:38.796: I/ApplicationPackageManager(12292): cscCountry is not German : SEB
09-13 14:59:38.843: D/SensorManager(12292): ====>>>>>Num Sensor: 1
09-13 14:59:38.843: D/SensorManager(12292): ====>>>>>Num Sensor: 2
09-13 14:59:38.851: D/SensorManager(12292): ====>>>>>Num Sensor: 3
09-13 14:59:38.851: D/SensorManager(12292): ====>>>>>Num Sensor: 4
09-13 14:59:38.851: D/SensorManager(12292): ====>>>>>Num Sensor: 5
09-13 14:59:38.851: D/SensorManager(12292): ====>>>>>Num Sensor: 6
09-13 14:59:38.851: D/SensorManager(12292): ====>>>>>Num Sensor: 0
09-13 14:59:38.882: I/ApplicationPackageManager(12292): cscCountry is not German : SEB
09-13 14:59:38.882: W/apk path(12292): /data/app/com.cococs.andgame-1.apk
09-13 14:59:39.039: I/GLThread(12292): noticed surfaceView surface lost tid=12
09-13 14:59:39.054: I/GLThread(12292): onResume tid=12
09-13 14:59:39.054: D/cocos2d-x debug info(12292): cocos2d: cocos2d-2.0-rc2-x-2.0.1
09-13 14:59:39.070: D/PhoneWindow(12292): couldn't save which view has focus because the focused view org.cocos2dx.lib.Cocos2dxGLSurfaceView@40524448 has no id.
09-13 14:59:39.093: I/GLThread(12292): onPause tid=12
09-13 14:59:39.093: I/Main thread(12292): onPause waiting for mPaused.

P.S. I’m running it on my real device because Android Emulator just doesn’t work at all. But it’s different talk.

Thanks for any help.

EDIT: My Console window showing me an error like this:

16:08:35 **** Incremental Build of configuration Default for project AndGame ****
cmd {workspace_loc:/com.cococs.andgame}./ NDK_DEBUG=1 V=1 all 
Cannot run program "cmd": The directory name is invalid.

16:08:35 Build Finished (took 18ms)

I rememeber what I went to my project Properties -> C/C*+ Build -> Unchecked “Use default build command” and write cmd / NDK_DEBUG=1 V=1 . Maybe here is the problem? Maybe I messed up something with this one? I added image how my C/C* Build window.

Untitled.png (90.5 KB)


My mistake on this problem was that I gave wrong option --app-api=x86.
so it was keep running from x86 built cache.
I cleared cache in /build/app/intermediates/x86.
and cleared/deleted all these x86 built class files cache in in this directory.
and I built again with right option which is --app-abi=x86.
Sometimes strange mistake leads waste of time :smile: