[Solved] Sdkbox facebook work well but other plugin fails whyy?

hiiii after running “sdkbox import facebook” i can build apk in cocos code ide with js.
but when i add adcolony “sdkbox import adcolony” and try to take build apk iam getting error. how to solve it.
error

Android NDK: WARNING: Unsupported source file extensions in jni/Android.mk for module cocos2djs_shared
Android NDK: …/…/Classes/PluginFacebookJS.hpp …/…/Classes/PluginFacebookJSHelper.h …/…/Classes/SDKBoxJSHelper.h
Android NDK: WARNING:E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/cocos2d-x/cocos/./Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
Android NDK: WARNING:E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/cocos2d-x/cocos/platform/android/Android.mk:cocos2dxandroid_static: LOCAL_LDLIBS is always ignored for static libraries
make.exe: Entering directory E:/Users/user/Documents/Cocos/testplug/frameworks/runtime-src/proj.android’
[armeabi] Compile++ thumb: cocos2djs_shared <= PluginAdColonyJSHelper.cpp
warning: unknown warning option ‘-Wno-psabi’ [-Wunknown-warning-option]
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:53:5: error: no matching function for call to ‘JS_SetProperty’
JS_SetProperty(cx, jsobj, “name”, &name);
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2957:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::Handle’ for 4th argument
JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:58:5: error: no matching function for call to ‘JS_SetProperty’
JS_SetProperty(cx, jsobj, “zoneID”, &zoneID);
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2957:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::Handle’ for 4th argument
JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:63:5: error: no matching function for call to ‘JS_SetProperty’
JS_SetProperty(cx, jsobj, “shown”, &shown);
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2957:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::Handle’ for 4th argument
JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:68:5: error: no matching function for call to ‘JS_SetProperty’
JS_SetProperty(cx, jsobj, “iapEnabled”, &iapEnabled);
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2957:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::Handle’ for 4th argument
JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:73:5: error: no matching function for call to ‘JS_SetProperty’
JS_SetProperty(cx, jsobj, “iapProductID”, &iapProductID);
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2957:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::Handle’ for 4th argument
JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:78:5: error: no matching function for call to ‘JS_SetProperty’
JS_SetProperty(cx, jsobj, “iapQuantity”, &iapQuantity);
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2957:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::Handle’ for 4th argument
JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:83:5: error: no matching function for call to ‘JS_SetProperty’
JS_SetProperty(cx, jsobj, “iapEngagementType”, &iapEngagementType);
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2957:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::Handle’ for 4th argument
JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:121:9: error: unknown type name ‘JSBool’; did you mean ‘cpBool’?
JSBool hasAction;
^~~~~~
cpBool
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/cocos2d-x/cocos/./…/external/chipmunk/include/chipmunk/chipmunk_types.h:150:14: note: ‘cpBool’ declared here
typedef int cpBool;
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:132:13: error: no matching function for call to ‘JS_HasProperty’
if (JS_HasProperty(cx, obj, func_name, &hasAction) && hasAction) {
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2757:1: note: candidate function not viable: no known conversion from ‘cpBool *’ (aka ‘int *’) to ‘bool *’ for 4th argument
JS_HasProperty(JSContext *cx, JSObject *obj, const char *name, bool *foundp);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:133:17: error: no matching function for call to ‘JS_GetProperty’
if(!JS_GetProperty(cx, obj, func_name, &func_handle)) {
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2947:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::MutableHandle’ for 4th argument
JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle vp);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:165:9: error: unknown type name ‘JSBool’; did you mean ‘cpBool’?
JSBool hasAction;
^~~~~~
cpBool
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/cocos2d-x/cocos/./…/external/chipmunk/include/chipmunk/chipmunk_types.h:150:14: note: ‘cpBool’ declared here
typedef int cpBool;
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:176:13: error: no matching function for call to ‘JS_HasProperty’
if (JS_HasProperty(cx, obj, func_name, &hasAction) && hasAction) {
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2757:1: note: candidate function not viable: no known conversion from ‘cpBool *’ (aka ‘int *’) to ‘bool *’ for 4th argument
JS_HasProperty(JSContext *cx, JSObject *obj, const char *name, bool *foundp);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:177:17: error: no matching function for call to ‘JS_GetProperty’
if(!JS_GetProperty(cx, obj, func_name, &func_handle)) {
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2947:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::MutableHandle’ for 4th argument
JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle vp);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:209:9: error: unknown type name ‘JSBool’; did you mean ‘cpBool’?
JSBool hasAction;
^~~~~~
cpBool
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/cocos2d-x/cocos/./…/external/chipmunk/include/chipmunk/chipmunk_types.h:150:14: note: ‘cpBool’ declared here
typedef int cpBool;
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:219:13: error: no matching function for call to ‘JS_HasProperty’
if (JS_HasProperty(cx, obj, func_name, &hasAction) && hasAction) {
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2757:1: note: candidate function not viable: no known conversion from ‘cpBool *’ (aka ‘int *’) to ‘bool *’ for 4th argument
JS_HasProperty(JSContext *cx, JSObject *obj, const char *name, bool *foundp);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:220:17: error: no matching function for call to ‘JS_GetProperty’
if(!JS_GetProperty(cx, obj, func_name, &func_handle)) {
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2947:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::MutableHandle’ for 4th argument
JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle vp);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:252:9: error: unknown type name ‘JSBool’; did you mean ‘cpBool’?
JSBool hasAction;
^~~~~~
cpBool
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/cocos2d-x/cocos/./…/external/chipmunk/include/chipmunk/chipmunk_types.h:150:14: note: ‘cpBool’ declared here
typedef int cpBool;
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:262:13: error: no matching function for call to ‘JS_HasProperty’
if (JS_HasProperty(cx, obj, func_name, &hasAction) && hasAction) {
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2757:1: note: candidate function not viable: no known conversion from ‘cpBool *’ (aka ‘int *’) to ‘bool *’ for 4th argument
JS_HasProperty(JSContext *cx, JSObject *obj, const char *name, bool *foundp);
^
jni/…/…/Classes/PluginAdColonyJSHelper.cpp:263:17: error: no matching function for call to ‘JS_GetProperty’
if(!JS_GetProperty(cx, obj, func_name, &func_handle)) {
^~~~~~~~~~~~~~
E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/external/spidermonkey/prebuilt/android/…/…/include/android\jsapi.h:2947:1: note: candidate function not viable: no known conversion from ‘jsval *’ (aka ‘JS::Value *’) to ‘JS::MutableHandle’ for 4th argument
JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle vp);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make.exe: *** [obj/local/armeabi/objs/cocos2djs_shared///Classes/PluginAdColonyJSHelper.o] Error 1
make.exe: Leaving directoryE:/Users/user/Documents/Cocos/testplug/frameworks/runtime-src/proj.android’
Running command: compile
Building mode: debug
building native
NDK build mode: release
running: ‘E:\Users\user\android-ndk-r9d\ndk-build -C E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android -j1 NDK_MODULE_PATH=E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings;E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/cocos2d-x;E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/cocos2d-x/cocos;E:\Users\user\Documents\Cocos\testplug\frameworks\runtime-src\proj.android…/…/js-bindings/cocos2d-x/external’

Ndk build failed!

Can you post which version of cocos2d-x are you using? Also which plugin is failing?

hiii nitee. iam using cocos2d js 3.0.cocos code ide 1.0.0RC2. adcolony,iap plugins are failing… i didn’t checked other pluginss

Ok, I’ll look into this.

thank youu nitee :slight_smile:

I created a bug, and you can track it’s progress here

1 Like

hotfix is here:

work with js226, js300, js360

replace with your PluginAdColonyJSHelper.cpp file:

#include "PluginAdColonyJSHelper.hpp"
#include "cocos2d_specifics.hpp"
#include "PluginAdColony/PluginAdColony.h"
#include "SDKBoxJSHelper.h"

extern JSObject* jsb_sdkbox_PluginAdColony_prototype;

static JSContext* s_cx = nullptr;

JSObject* adinfo_to_obj(JSContext* cx, const sdkbox::AdColonyAdInfo& info)
{
#if defined(MOZJS_MAJOR_VERSION)
#if MOZJS_MAJOR_VERSION >= 33
    JS::RootedObject jsobj(cx, JS_NewObject(cx, NULL, JS::NullPtr(), JS::NullPtr()));
    JS::RootedValue name(cx);
    name = std_string_to_jsval(cx, info.name);

    JS_SetProperty(cx, jsobj, "name", name);

    JS::RootedValue zoneID(cx);
    zoneID = std_string_to_jsval(cx, info.zoneID);

    JS_SetProperty(cx, jsobj, "zoneID", zoneID);

    JS::RootedValue shown(cx);
    shown = BOOLEAN_TO_JSVAL(info.shown);

    JS_SetProperty(cx, jsobj, "shown", shown);

    JS::RootedValue iapEnabled(cx);
    iapEnabled = BOOLEAN_TO_JSVAL(info.iapEnabled);

    JS_SetProperty(cx, jsobj, "iapEnabled", iapEnabled);

    JS::RootedValue iapProductID(cx);
    iapProductID = std_string_to_jsval(cx, info.iapProductID);

    JS_SetProperty(cx, jsobj, "iapProductID", iapProductID);

    JS::RootedValue iapQuantity(cx);
    iapQuantity = INT_TO_JSVAL(info.iapQuantity);

    JS_SetProperty(cx, jsobj, "iapQuantity", iapQuantity);

    JS::RootedValue iapEngagementType(cx);
    iapEngagementType = INT_TO_JSVAL(info.iapEngagementType);

    JS_SetProperty(cx, jsobj, "iapEngagementType", iapEngagementType);
#else
    JSObject* jsobj = JS_NewObject(cx, NULL, NULL, NULL);

    JS::RootedValue name(cx);
    name = std_string_to_jsval(cx, info.name);
    JS_SetProperty(cx, jsobj, "name", name);

    JS::RootedValue zoneID(cx);
    zoneID = std_string_to_jsval(cx, info.zoneID);
    JS_SetProperty(cx, jsobj, "zoneID", zoneID);

    JS::RootedValue shown(cx);
    shown = BOOLEAN_TO_JSVAL(info.shown);
    JS_SetProperty(cx, jsobj, "shown", shown);

    JS::RootedValue iapEnabled(cx);
    iapEnabled = BOOLEAN_TO_JSVAL(info.iapEnabled);
    JS_SetProperty(cx, jsobj, "iapEnabled", iapEnabled);

    JS::RootedValue iapProductID(cx);
    iapProductID = std_string_to_jsval(cx, info.iapProductID);
    JS_SetProperty(cx, jsobj, "iapProductID", iapProductID);

    JS::RootedValue iapQuantity(cx);
    iapQuantity = INT_TO_JSVAL(info.iapQuantity);
    JS_SetProperty(cx, jsobj, "iapQuantity", iapQuantity);

    JS::RootedValue iapEngagementType(cx);
    iapEngagementType = INT_TO_JSVAL(info.iapEngagementType);
    JS_SetProperty(cx, jsobj, "iapEngagementType", iapEngagementType);
#endif
#elif defined(JS_VERSION)
    JSObject* jsobj = JS_NewObject(cx, NULL, NULL, NULL);
    jsval name;
    name = std_string_to_jsval(cx, info.name);

    JS_SetProperty(cx, jsobj, "name", &name);

    jsval zoneID;
    zoneID = std_string_to_jsval(cx, info.zoneID);

    JS_SetProperty(cx, jsobj, "zoneID", &zoneID);

    jsval shown;
    shown = BOOLEAN_TO_JSVAL(info.shown);

    JS_SetProperty(cx, jsobj, "shown", &shown);

    jsval iapEnabled;
    iapEnabled = BOOLEAN_TO_JSVAL(info.iapEnabled);

    JS_SetProperty(cx, jsobj, "iapEnabled", &iapEnabled);

    jsval iapProductID;
    iapProductID = std_string_to_jsval(cx, info.iapProductID);

    JS_SetProperty(cx, jsobj, "iapProductID", &iapProductID);

    jsval iapQuantity;
    iapQuantity = INT_TO_JSVAL(info.iapQuantity);

    JS_SetProperty(cx, jsobj, "iapQuantity", &iapQuantity);

    jsval iapEngagementType;
    iapEngagementType = INT_TO_JSVAL(info.iapEngagementType);

    JS_SetProperty(cx, jsobj, "iapEngagementType", &iapEngagementType);
#endif

    return jsobj;
}

class AdColonyListenerWrapper : public sdkbox::AdColonyListener
{
private:
    JSObject* _JSDelegate;
public:
    void setJSDelegate(JSObject* delegate)
    {
        _JSDelegate = delegate;
    }

    JSObject* getJSDelegate()
    {
        return _JSDelegate;
    }

    void onAdColonyChange(const sdkbox::AdColonyAdInfo& info, bool available)
    {
        if (!s_cx)
        {
            return;
        }
        JSContext* cx = s_cx;
        const char* func_name = "onAdColonyChange";

        JS::RootedObject obj(cx, _JSDelegate);
        JSAutoCompartment ac(cx, obj);

#if defined(MOZJS_MAJOR_VERSION)
#if MOZJS_MAJOR_VERSION >= 33
        bool hasAction;
        JS::RootedValue retval(cx);
        JS::RootedValue func_handle(cx);
#else
        bool hasAction;
        jsval retval;
        JS::RootedValue func_handle(cx);
#endif
#elif defined(JS_VERSION)
        JSBool hasAction;
        jsval retval;
        jsval func_handle;
#endif

        jsval dataVal[2];

        jsval value = OBJECT_TO_JSVAL(adinfo_to_obj(s_cx, info));

        dataVal[0] = value;
        dataVal[1] = BOOLEAN_TO_JSVAL(available);

        if (JS_HasProperty(cx, obj, func_name, &hasAction) && hasAction) {
            if(!JS_GetProperty(cx, obj, func_name, &func_handle)) {
                return;
            }
            if(func_handle == JSVAL_VOID) {
                return;
            }

#if MOZJS_MAJOR_VERSION >= 31
            JS_CallFunctionName(cx, obj, func_name, JS::HandleValueArray::fromMarkedLocation(sizeof(dataVal)/sizeof(*dataVal), dataVal), &retval);
#else
            JS_CallFunctionName(cx, obj, func_name, sizeof(dataVal)/sizeof(*dataVal), dataVal, &retval);
#endif
        }
    }

    void onAdColonyReward(const sdkbox::AdColonyAdInfo& info, const std::string& currencyName, int amount, bool success)
    {
        if (!s_cx)
        {
            return;
        }
        JSContext* cx = s_cx;
        const char* func_name = "onAdColonyReward";

        JS::RootedObject obj(cx, _JSDelegate);
        JSAutoCompartment ac(cx, obj);

#if defined(MOZJS_MAJOR_VERSION)
#if MOZJS_MAJOR_VERSION >= 33
        bool hasAction;
        JS::RootedValue retval(cx);
        JS::RootedValue func_handle(cx);
#else
        bool hasAction;
        jsval retval;
        JS::RootedValue func_handle(cx);
#endif
#elif defined(JS_VERSION)
        JSBool hasAction;
        jsval retval;
        jsval func_handle;
#endif
        jsval dataVal[4];
        jsval value = OBJECT_TO_JSVAL(adinfo_to_obj(s_cx, info));
        dataVal[0] = value;
        dataVal[1] = std_string_to_jsval(cx, currencyName);
        dataVal[2] = INT_TO_JSVAL(amount);
        dataVal[3] = BOOLEAN_TO_JSVAL(success);

        if (JS_HasProperty(cx, obj, func_name, &hasAction) && hasAction) {
            if(!JS_GetProperty(cx, obj, func_name, &func_handle)) {
                return;
            }
            if(func_handle == JSVAL_VOID) {
                return;
            }

#if MOZJS_MAJOR_VERSION >= 31
            JS_CallFunctionName(cx, obj, func_name, JS::HandleValueArray::fromMarkedLocation(sizeof(dataVal)/sizeof(*dataVal), dataVal), &retval);
#else
            JS_CallFunctionName(cx, obj, func_name, sizeof(dataVal)/sizeof(*dataVal), dataVal, &retval);
#endif
        }
    }

    void onAdColonyStarted(const sdkbox::AdColonyAdInfo& info)
    {
        if (!s_cx)
        {
            return;
        }
        JSContext* cx = s_cx;
        const char* func_name = "onAdColonyStarted";

        JS::RootedObject obj(cx, _JSDelegate);
        JSAutoCompartment ac(cx, obj);

#if defined(MOZJS_MAJOR_VERSION)
#if MOZJS_MAJOR_VERSION >= 33
        bool hasAction;
        JS::RootedValue retval(cx);
        JS::RootedValue func_handle(cx);
#else
        bool hasAction;
        jsval retval;
        JS::RootedValue func_handle(cx);
#endif
#elif defined(JS_VERSION)
        JSBool hasAction;
        jsval retval;
        jsval func_handle;
#endif
        jsval dataVal[1];

        jsval value = OBJECT_TO_JSVAL(adinfo_to_obj(s_cx, info));

        dataVal[0] = value;

        if (JS_HasProperty(cx, obj, func_name, &hasAction) && hasAction) {
            if(!JS_GetProperty(cx, obj, func_name, &func_handle)) {
                return;
            }
            if(func_handle == JSVAL_VOID) {
                return;
            }

#if MOZJS_MAJOR_VERSION >= 31
            JS_CallFunctionName(cx, obj, func_name, JS::HandleValueArray::fromMarkedLocation(sizeof(dataVal)/sizeof(*dataVal), dataVal), &retval);
#else
            JS_CallFunctionName(cx, obj, func_name, sizeof(dataVal)/sizeof(*dataVal), dataVal, &retval);
#endif
        }
    }

    void onAdColonyFinished(const sdkbox::AdColonyAdInfo& info)
    {
        if (!s_cx)
        {
            return;
        }
        JSContext* cx = s_cx;
        const char* func_name = "onAdColonyFinished";

        JS::RootedObject obj(cx, _JSDelegate);
        JSAutoCompartment ac(cx, obj);

#if defined(MOZJS_MAJOR_VERSION)
#if MOZJS_MAJOR_VERSION >= 33
        bool hasAction;
        JS::RootedValue retval(cx);
        JS::RootedValue func_handle(cx);
#else
        bool hasAction;
        jsval retval;
        JS::RootedValue func_handle(cx);
#endif
#elif defined(JS_VERSION)
        JSBool hasAction;
        jsval retval;
        jsval func_handle;
#endif
        jsval dataVal[1];

        jsval value = OBJECT_TO_JSVAL(adinfo_to_obj(s_cx, info));

        dataVal[0] = value;

        if (JS_HasProperty(cx, obj, func_name, &hasAction) && hasAction) {
            if(!JS_GetProperty(cx, obj, func_name, &func_handle)) {
                return;
            }
            if(func_handle == JSVAL_VOID) {
                return;
            }

#if MOZJS_MAJOR_VERSION >= 31
            JS_CallFunctionName(cx, obj, func_name, JS::HandleValueArray::fromMarkedLocation(sizeof(dataVal)/sizeof(*dataVal), dataVal), &retval);
#else
            JS_CallFunctionName(cx, obj, func_name, sizeof(dataVal)/sizeof(*dataVal), dataVal, &retval);
#endif
        }
    }

};

#if defined(MOZJS_MAJOR_VERSION)
#if MOZJS_MAJOR_VERSION >= 33
bool js_PluginAdColonyJS_PluginAdColony_setListener(JSContext *cx, uint32_t argc, jsval *vp)
#else
bool js_PluginAdColonyJS_PluginAdColony_setListener(JSContext *cx, uint32_t argc, jsval *vp)
#endif
#elif defined(JS_VERSION)
JSBool js_PluginAdColonyJS_PluginAdColony_setListener(JSContext *cx, uint32_t argc, jsval *vp)
#endif
{
    s_cx = cx;
    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    bool ok = true;

    if (argc == 1) {

        if (!args.get(0).isObject())
        {
            ok = false;
        }
        JSObject *tmpObj = args.get(0).toObjectOrNull();

        JSB_PRECONDITION2(ok, cx, false, "js_PluginAdColonyJS_PluginAdColony_setIAPListener : Error processing arguments");
        AdColonyListenerWrapper* wrapper = new AdColonyListenerWrapper();
        wrapper->setJSDelegate(tmpObj);
        sdkbox::PluginAdColony::setListener(wrapper);

        args.rval().setUndefined();
        return true;
    }
    JS_ReportError(cx, "js_PluginAdColonyJS_PluginAdColony_setIAPListener : wrong number of arguments");
    return false;
}

#if defined(MOZJS_MAJOR_VERSION)
#if MOZJS_MAJOR_VERSION >= 33
void register_all_PluginAdColonyJS_helper(JSContext* cx, JS::HandleObject global) {
    JS::RootedObject pluginObj(cx);
    sdkbox::getJsObjOrCreat(cx, global, "sdkbox.PluginAdColony", &pluginObj);

    JS_DefineFunction(cx, pluginObj, "setListener", js_PluginAdColonyJS_PluginAdColony_setListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
}
#else
void register_all_PluginAdColonyJS_helper(JSContext* cx, JSObject* global) {
    JS::RootedObject pluginObj(cx);
    sdkbox::getJsObjOrCreat(cx, JS::RootedObject(cx, global), "sdkbox.PluginAdColony", &pluginObj);

    JS_DefineFunction(cx, pluginObj, "setListener", js_PluginAdColonyJS_PluginAdColony_setListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
}
#endif
#elif defined(JS_VERSION)
void register_all_PluginAdColonyJS_helper(JSContext* cx, JSObject* global) {
    jsval pluginVal;
    JSObject* pluginObj;
    pluginVal = sdkbox::getJsObjOrCreat(cx, global, "sdkbox.PluginAdColony", &pluginObj);
    
    JS_DefineFunction(cx, pluginObj, "setListener", js_PluginAdColonyJS_PluginAdColony_setListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
}
#endif

we will check the other plugins again.

1 Like

thankkk youuuu

thankkssss for the hotfixx… :slight_smile: now i can make apk build. once agin thanksss for the support :smile: