Integration help for c++

If you need help integrating SDKBOX with your c++ app.

Is SDKBox opensource and does it work with 3.3 ? Sorry for dumb questions, but couldn’t find any documentation links.

Documentation is included as part of the download.

It is NOT opensource at this time. It is still under development.

3.3 should work. It is still under certification but in testing I have not run into any problems yet.

Hi,

Thank you for SDKBOX.

I read the “installation_guide.pdf” but I don’t really understand how can I provide players rewards.

For example, for chartboost: Do I have to override the onChartboostReward function?

In the chartboost documentation, they talk about a didCompleteRewardedVideo function. Is there a link between those two functions?

@inakicm - I am going to have one of our engineers help you out with this. My understanding is that you get a redress for watching the videos. The logic for taking that rewards and applying it to your users playing the game is up to you. Maybe you game has coins or something.

Yes you have to override onChartboostReward(name, reward) function, and we’ll working on the documentation for that. name is the name/placement of your ads, reward is the amount of the virtual currency

Okay, thank you very much for the futur documentation.

great news that it works on 3.3
could you please tell us when the new version release?
thank you

Sure i will.

Btw. Available!!

Hi
I integrate Vungle, AdColony and Chartboost and now always get error:

Undefined symbols for architecture arm64:
  "sdkbox::dataToProduct(char const*)", referenced from:
      sdkbox::IAP::onProductRequestResult(sdkbox::ProductRequestCode, char const*, char const*) in sdkbox(IAP.o)

I check few times integration guid and don’t find reason where I wrong. Cocos2dx 3.5

I probabaly find the problem.
Then add flag -ObjC to the Build Setting->Other Linker Flags then we get that error. But without -ObjC flag soomla plugin doesn’t work.

AdColony needs a few linker flags. If you are integrating another SDK like Soomla, there may be some coordinating that needs to happen to get everything going. I can ask @nite to help us.

I getting this error without AdColony, with Chartboost and Vungle only

Also when I try build android version I get error:

error: package org.cocos2dx.plugin does not exist
[javac] import org.cocos2dx.plugin.PluginWrapper;

I have the same problem. what i made was putting all the code in AppActivity.java:

package org.cocos2dx.cpp;

import org.cocos2dx.lib.Cocos2dxActivity;
import android.content.Intent;
import org.cocos2dx.plugin.PluginWrapper;
import android.os.Bundle;

public class AppActivity extends Cocos2dxActivity {

	@Override
    protected void onCreate(final Bundle savedInstanceState)
		{
        super.onCreate(savedInstanceState);
        PluginWrapper.init(this);		
		}
		
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	if(!PluginWrapper. onActivityResult(requestCode, resultCode, data)) {
	super. onActivityResult(requestCode, resultCode, data);
	}
	}
	@Override
	protected void onStart() {
	super.onStart();
	PluginWrapper.onStart();
	}
	@Override
	protected void onStop() {
	super.onStop();
	PluginWrapper. onStop();
	}
	@Override
	protected void onResume() {
	super.onResume();
	PluginWrapper. onResume();
	}
	
	@Override
	protected void onPause() {
	super.onPause();	
	PluginWrapper.onPause();
	}

	@Override
	public void onBackPressed() {
	if(!PluginWrapper. onBackPressed()) {
	super. onBackPressed();
	}
	}

}

It is compiling ok (without errors) but i dont see the ads.

I’m sorry, can we can we clarify what Cocos2d-x version and what SDKBOX plugins exactly we are working with? I can test and also ask @nite for help as well.

Hello,

In my team we are using Cocos2d-x 3.4 (RC1) and we are giving SDKBOX a try to integrate cross-platform ads with the AdColony plugin.

We followed the guide step by step and just worked on iOS, but the Android part is very troublesome and we didn’t achieve to get it working. We did it with the SDKBOX 1.0 and with the brand new version 1.0.1, but neither did work for us.
The guide asks for overriding some methods of the Cocos2dxActivity.java file (we modified the one inside cocos2d/cocos/platform/android/java/src/org/ cocos2dx/lib/ as we are using Cocos2d-x from source) by simply copying the provided code anywhere within the class. However:

  • onActivityResult() -> Already exists, so we copied the code inside the existing one.
  • onStart() -> Does not exist. Throws undefined symbol when building.
  • onStop() -> Does not exist. Throws undefined symbol when building.
  • onResume() -> Already exists, so we copied the code inside the existing one.
  • onPause() -> Already exists, so we copied the code inside the existing one.
  • onBackPressed() -> Does not exist. Throws undefined symbol when building.

After a lot of research through Cocos2d-x classes, java classes, Android.mk files, plugin folders and files… we ended trying not to override those throwing undefined symbols, just to try what would happen. The result is that then the build process continues, but a new error arises in the final stages:

[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] com.android.dex.DexException: Multiple dex files define Lorg/cocos2dx/plugin/AdsWrapper$1;
etc.

After some more research, googling, etc. we noticed the problem was related to the dex generation because some .jar file may have a duplicated symbol. We tried almost everything, until it “worked”: We dragged out the sdkbox.jar file from the plugins folder and then the build process was successful and the APK generated. BUT, when accessing a scene in which AdColony is used, the app just crashes. The Android Monitor throws some different logs:

At application startup:

05-26 19:33:54.607: E/MediaPlayer(32155): Should have subtitle controller already set
05-26 19:33:54.610: D/CSC(32155): no asset manager
05-26 19:33:54.611: E/CSC(32155): Failed to find config file: sdkbox_config.json

When entering a scene that uses the plugin:

05-26 19:37:32.540: D/PluginFactory(32155): Java class name of plugin PluginAdColony is : org/cocos2dx/plugin/PluginAdColony
05-26 19:37:32.540: D/PluginFactory(32155): Can't find method initPlugin in class org.cocos2dx.plugin.PluginWrapper
05-26 19:37:32.540: D/CSC(32155): Tracking initialized: CDID *omitted ID*
05-26 19:37:32.541: A/libc(32155): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 32181 (GLThread 2144)

Which should be normal as the sdkbox.jar is not included and that may have broken something. But if that .jar file was inside the plugins folder, it directly wouldn’t generate the APK.

We have lost almost a whole day with this, so we finally went here to ask for help. It would be greatly appreciated if someone could help us!
Thank you in advance.

First, I am not sure if using 3.4RC1 is a good idea. At last 3.5.

Second, for Cocos2dxActivity.java. Can you show me your .java file so that I can take a look at it?

You definitely need sdkbox.jar and the corresponding jni folder.

I am also going to ask @nite to look at your post and help us.

Ok, i am using cocos2d-x 3.6 and i am trying to integrate charboost on my project. i download the sdkbox for chartboost 1.0.1 for cocos2d-x 3.0+. In the tutorial (pdf) the part where you have to edit Cocos2dxActivity.java doesnt work for me. so i decide to put the code on AppActivity.java but it doesnt work either.

1 Like

Thank you for your quick response!

We know that using 3.4RC1 is not ideal, but we tried to upgrade the version of Cocos2d-x used in the project some weeks ago and it resulted in a total mess and another entire day lost (guides didn’t apply to our case because when the project was created, we decided to included the whole cocos framework within the project instead of referencing an installed one to avoid possible side effects and to synchronize it with git). We would be grateful if someone could indicate us how to upgrade our cocos project to a newer version of cocos.

Sure, here is our Cocos2dActivity.java file:

Cocos2dxActivity.java.zip (4.3 KB)

Thank you!