[Help!]Not able to install SDKBOX Chartboost plugin

I want to install SDKBOX Chartboost plugin…Each time when I tried installing it using the command sdkbox import chartboost, I’m getting it as installation failed…
Can someone help me out with this??

When I tried to do it manually I’m getting error like sdkbox is not defined…can someone help??

Hello @monisha

Could you please check with our sample app and see if it works for you.
https://github.com/sdkbox/sdkbox-chartboost-sample

Best,
Pabitra

this means it’s failed to download the plugin, maybe due to the internet connection, I suggest you can try download chartboost plugin here http://cocos2d-x.org/sdkbox/chartboost

and install with

sdkbox import -b <path_to_chartboost_plugin>

Hello pabitrapadhy,
I tried with the sample project and I’m getting the same error…“sdkbox is not defined”

hello nite,
I downloaded the chartboost plugin from the link…I used the command which u specified…and this is what I’m getting…

I’m getting the same error again…“sdkbox is not defined”

In your last log entry it shows the plugin was completed. It’s just failed to patch AppDelegate.cpp which is actually okey.

But then… Why am I still getting as skbox is not defined??

Hi @monisha

The patch in AppDelegate does the following thing -

#include "PluginChartboost/PluginChartboost.h"
AppDelegate::applicationDidFinishLaunching()
{
     sdkbox::PluginChartboost::init();
}

It adds the header file for chartboost and also initializes SDKBOX chartboost plugin.
Could you please make sure that you have initialized it.

Best,
Pabitra

Hi @pabitrapadhy

I have initialized it…and still i’m getting the same error… here is my code in AppDelegate file

#include "AppDelegate.h"

#include "SimpleAudioEngine.h"
#include "jsb_cocos2dx_auto.hpp"
#include "jsb_cocos2dx_ui_auto.hpp"
#include "jsb_cocos2dx_studio_auto.hpp"
#include "jsb_cocos2dx_builder_auto.hpp"
#include "jsb_cocos2dx_spine_auto.hpp"
#include "jsb_cocos2dx_extension_auto.hpp"
#include "jsb_cocos2dx_3d_auto.hpp"
#include "jsb_cocos2dx_3d_extension_auto.hpp"
#include "3d/jsb_cocos2dx_3d_manual.h"
#include "ui/jsb_cocos2dx_ui_manual.h"
#include "cocostudio/jsb_cocos2dx_studio_manual.h"
#include "cocosbuilder/js_bindings_ccbreader.h"
#include "spine/jsb_cocos2dx_spine_manual.h"
#include "extension/jsb_cocos2dx_extension_manual.h"
#include "localstorage/js_bindings_system_registration.h"
#include "chipmunk/js_bindings_chipmunk_registration.h"
#include "jsb_opengl_registration.h"
#include "network/XMLHTTPRequest.h"
#include "network/jsb_websocket.h"
#include "network/jsb_socketio.h"

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "platform/android/CCJavascriptJavaBridge.h"
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#include "platform/ios/JavaScriptObjCBridge.h"
#endif

#include "PluginChartboost/PluginChartboost.h"
#include "PluginChartboostJS.hpp"
#include "PluginChartboostJSHelper.h"


#include "CodeIDESupport.h"
#include "Runtime.h"
#include "ConfigParser.h"


USING_NS_CC;
using namespace CocosDenshion;

AppDelegate::AppDelegate()
{
}

AppDelegate::~AppDelegate()
{
ScriptEngineManager::destroyInstance();
#if (COCOS2D_DEBUG > 0 && CC_CODE_IDE_DEBUG_SUPPORT > 0)
// NOTE:Please don't remove this call if you want to debug with Cocos Code IDE
endRuntime();
#endif

ConfigParser::purge();
}

void AppDelegate::initGLContextAttrs()
{
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};

GLView::setGLContextAttrs(glContextAttrs);
}

bool AppDelegate::applicationDidFinishLaunching()
{	
     sdkbox::PluginChartboost::init();

#if (COCOS2D_DEBUG > 0 && CC_CODE_IDE_DEBUG_SUPPORT > 0)
// NOTE:Please don't remove this call if you want to debug with Cocos Code IDE
initRuntime();
#endif
// initialize director

auto director = Director::getInstance();
auto glview = director->getOpenGLView();    
if(!glview) {
    Size viewSize = ConfigParser::getInstance()->getInitViewSize();
    string title = ConfigParser::getInstance()->getInitViewName();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) && (COCOS2D_DEBUG > 0 && CC_CODE_IDE_DEBUG_SUPPORT > 0)
    extern void createSimulator(const char* viewName, float width, float height,bool isLandscape = true, float frameZoomFactor = 1.0f);
    bool isLanscape = ConfigParser::getInstance()->isLanscape();
    createSimulator(title.c_str(), viewSize.width,viewSize.height, isLanscape);
#else
    glview = cocos2d::GLViewImpl::createWithRect(title.c_str(), Rect(0, 0, viewSize.width, viewSize.height));
    director->setOpenGLView(glview);
#endif
}

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

ScriptingCore* sc = ScriptingCore::getInstance();
sc->addRegisterCallback(register_all_cocos2dx);
sc->addRegisterCallback(register_cocos2dx_js_core);
sc->addRegisterCallback(jsb_register_system);

// extension can be commented out to reduce the package
sc->addRegisterCallback(register_all_cocos2dx_extension);
sc->addRegisterCallback(register_all_cocos2dx_extension_manual);

// chipmunk can be commented out to reduce the package
sc->addRegisterCallback(jsb_register_chipmunk);
// opengl can be commented out to reduce the package
sc->addRegisterCallback(JSB_register_opengl);

// builder can be commented out to reduce the package
sc->addRegisterCallback(register_all_cocos2dx_builder);
sc->addRegisterCallback(register_CCBuilderReader);

// ui can be commented out to reduce the package, attension studio need ui module
sc->addRegisterCallback(register_all_cocos2dx_ui);
sc->addRegisterCallback(register_all_cocos2dx_ui_manual);

// studio can be commented out to reduce the package, 
sc->addRegisterCallback(register_all_cocos2dx_studio);
sc->addRegisterCallback(register_all_cocos2dx_studio_manual);

// spine can be commented out to reduce the package
sc->addRegisterCallback(register_all_cocos2dx_spine);
sc->addRegisterCallback(register_all_cocos2dx_spine_manual);

// XmlHttpRequest can be commented out to reduce the package
sc->addRegisterCallback(MinXmlHttpRequest::_js_register);
// websocket can be commented out to reduce the package
sc->addRegisterCallback(register_jsb_websocket);
// sokcet io can be commented out to reduce the package
sc->addRegisterCallback(register_jsb_socketio);

// 3d can be commented out to reduce the package
sc->addRegisterCallback(register_all_cocos2dx_3d);
sc->addRegisterCallback(register_all_cocos2dx_3d_manual);

// 3d extension can be commented out to reduce the package
sc->addRegisterCallback(register_all_cocos2dx_3d_extension);

sc->addRegisterCallback(register_all_PluginChartboostJS);
sc->addRegisterCallback(register_all_PluginChartboostJS_helper);


#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS|| CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
sc->addRegisterCallback(JavaScriptObjCBridge::_js_register);
#endif

#if (COCOS2D_DEBUG > 0 && CC_CODE_IDE_DEBUG_SUPPORT > 0)
// NOTE:Please don't remove this call if you want to debug with Cocos Code IDE
startRuntime();
#else
sc->start();
sc->runScript("script/jsb_boot.js");
auto engine = ScriptingCore::getInstance();
ScriptEngineManager::getInstance()->setScriptEngine(engine);
ScriptingCore::getInstance()->runScript(ConfigParser::getInstance()->getEntryFile().c_str());
#endif

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()
{
auto director = Director::getInstance();
director->stopAnimation();
director->getEventDispatcher()->dispatchCustomEvent("game_on_hide");
SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
SimpleAudioEngine::getInstance()->pauseAllEffects();    

}

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
auto director = Director::getInstance();
director->startAnimation();
director->getEventDispatcher()->dispatchCustomEvent("game_on_show");
SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
SimpleAudioEngine::getInstance()->resumeAllEffects();
}

can you try our chartboost sample and see if it works for you?
https://github.com/sdkbox/sdkbox-chartboost-sample

It looks like your AppDelegate file is correct, are you getting “sdkbox is not defined” error in c++ or js code?

I’m getting the error in js code… I tried with the sample… its not working for me… getting the same error “sdkbox is not defined”…

Are you trying on the browser? or on the iOS, android device?

I’m trying it on android device(blue stacks)…

When I was searching through the forum I got the below link

When I downloaded the sample project from the above link and when I tested it in my android device…it worked well…
I also edited app.js file and took a build of it… I did not get any error such as " sdkbox is not defined ".
So I was just looking through all the files in the sample project and I was surprised to see that …the sample project was different from the chartboost plugin documentation…
It had only few changes done in it and it was working…I’m really confused now…

Hello @monisha

I would recommend to check all the plugins on a real android device.
Blue Stacks most of the time doesn’t help to replicate the usage of a real android device (from my personal experience) .

Let us know what are your results on a real device.

Best,
Pabitra

Can you let me know what did you change to make it working?

I did not do much changes…I just downloaded the zip file from the link which I posted above (i.e.,from here “https://goo.gl/ZMFoDw”)…and I just changed the app.js file…
I commented the code which was already in it and added another code …it worked …
Here’s the code in my app.js file…

var HelloWorldLayer = cc.Layer.extend({
    sprite:null,
    ctor:function () {
    //////////////////////////////
    // 1. super init first
    this._super();

   /* var ui = ccs.load(res.MainScene_json);
    this.addChild(ui.node);
    sdkbox.PluginChartboost.init();

     var btn = ui.node.getChildByName("btn1");
     if (btn) {
      btn.addClickEventListener(function(){
        sdkbox.PluginChartboost.show("Default");
      });
    }*/
 

    sdkbox.PluginChartboost.init();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.
    // ask the window size
    var size = cc.winSize;


    // add a "close" icon to exit the progress. it's an autorelease object
    var closeItem = new cc.MenuItemImage(
    		res.CloseNormal_png,
    		res.CloseSelected_png,
    		function () {
    			sdkbox.PluginChartboost.show("Default");

    			cc.log("Menu is clicked!");
    		}, this);
    closeItem.attr({
    	x: size.width - 20,
    	y: 20,
    	anchorX: 0.5,
    	anchorY: 0.5
    });

    var menu = new cc.Menu(closeItem);
    menu.x = 0;
    menu.y = 0;
    this.addChild(menu, 1);

    /////////////////////////////
    // 3. add your codes below...
    // add a label shows "Hello World"
    // create and initialize a label
    var helloLabel = new cc.LabelTTF("Hello World", "Arial", 38);
    // position the label on the center of the screen
    helloLabel.x = size.width / 2;
    helloLabel.y = 0;
    // add the label as a child to this layer
    this.addChild(helloLabel, 5);

    // add "HelloWorld" splash screen"
    this.sprite = new cc.Sprite(res.HelloWorld_png);
    this.sprite.attr({
    	x: size.width / 2,
    	y: size.height / 2,
    	scale: 0.5,
    	rotation: 180
    });
    this.addChild(this.sprite, 0);

    this.sprite.runAction(
    		cc.sequence(
    				cc.rotateTo(2, 0),
    				cc.scaleTo(2, 1, 1)
    		)
    );
    helloLabel.runAction(
    		cc.spawn(
    				cc.moveBy(2.5, cc.p(0, size.height - 40)),
    				cc.tintTo(2.5,255,125,0)
    		)
    );
    return true;


    
   }
});

var HelloWorldScene = cc.Scene.extend({
    onEnter:function () {
    this._super();
    var layer = new HelloWorldLayer();
    this.addChild(layer);
  }
});

Hello @pabitrapadhy,

Yea… I’ll try it on real android device and let you know the results…

hello @pabitrapadhy,
I tried it on real android device and the result is the same…my program is not running…

So it’s not working on the real device, can you post the error message?