Attempting to Integrate ScoreLoop with Latest Development Version

Hi, I just pulled the latest development build of Cocos2d-x-3.0 (“Merge pull request #5973 from ricardoquesada/chipmunk_6_2_1”). I’ve been trying to upgrade my project from 2.2.1, but I’m stuck on the Scoreloop integration because the Scoreloop terms of service popup uses a webview. Cocos2d-x-3.0rc0 won’t work because it uses a NativeActivity, which prevents Scoreloop from raising its webview. When I integrate Scoreloop and run the project under the stable Cocos2d-x-3.0rc0, the app runs, but the webview just doesn’t work so I can’t accept Scoreloop’s terms of service.

Since the merging of “Merge pull request #5955 from Dhilan007/develop_removeNativeActivity”, however, the bleeding edge version is back to using Cocos2dxActivity, so in theory Scoreloop’s webview should work.

I’ve got Scoreloop integrated into the development build project as far as I can tell, and my project runs fine when I set my ENABLE_SCORELOOP directive to 0 so as not to compile any part of my code that uses Scoreloop. However, if I enable Scoreloop, the app crashes in the following snippet near the top of AppDelegate::applicationDidFinishLaunching(), on the line SC_Error_t err = SC_Client_NewWithConfig(&scoreloopClient_, scoreloopClientConfig_);:

bool AppDelegate::applicationDidFinishLaunching()
{
    log("AppDelegate::applicationDidFinishLaunching() -- enter");
    SC_ClientConfig_SetGameIdentifier(scoreloopClientConfig_, GameID);
    log("AppDelegate::applicationDidFinishLaunching() -- 0");
    SC_ClientConfig_SetGameSecret(scoreloopClientConfig_, GameSecret);
    log("AppDelegate::applicationDidFinishLaunching() -- 1");
    SC_ClientConfig_SetGameVersion(scoreloopClientConfig_, Version);
    log("AppDelegate::applicationDidFinishLaunching() -- 2");
    SC_ClientConfig_SetGameCurrency(scoreloopClientConfig_, Currency);
    log("AppDelegate::applicationDidFinishLaunching() -- 3");
    
    // problem line
    SC_Error_t err = SC_Client_NewWithConfig(&scoreloopClient_, scoreloopClientConfig_);
    
    if(err != SC_OK)
    {
        log("Could not initialize SC_Client: %d", err);
    }
    else
    {
        log("Scoreloop initialized.");
        err = SC_Client_CreateScoreController( scoreloopClient_, &scoreController_, AppDelegate_scoreControllerCallback , NULL );

        if( err == SC_OK )
        {
            log("ScoreController initialized.");
        }
        else
        {
            log("Could not initialize ScoreController: %s", SC_MapErrorToStr(err));
        }
    }

// ... rest of applicationDidFinishLaunching()
}

None of the logs after the problem line go off. There are two internal logs I don’t understand that happens right when it crashes, though:

03-25 20:34:24.914: I/DEBUG(19331):     #05  pc 001c255b  /data/app-lib/com.pms.zwkyf-1/libcocos2dcpp.so (AppDelegate::applicationDidFinishLaunching()+106)

03-25 20:34:25.885: D/CrashAnrDetector(702):     #05  pc 001c255b  /data/app-lib/com.pms.zwkyf-1/libcocos2dcpp.so (AppDelegate::applicationDidFinishLaunching()+106)

Any ideas?

Solved. Turns out I just hadn’t added all the necessary code from the proj.android/jni/main.cpp file in the Scoreloop sample to my main.cpp.

On the bright side, the webview is now working fine and I’m testing the development build of Cocos…