SDKBOX ReferenceError: Can't find variable: sdkbox

      admobInit: function() {
                     if (cc.sys.isMobile) {
                         var e = this;
                         sdkbox.PluginAdMob.setListener({     **<- this line error**
                             adViewDidReceiveAd: function(t) {
                                 e.showInfo("adViewDidReceiveAd name=" + t)
                             },
                                adViewDidFailToReceiveAdWithError: function(t, i) {
                                     e.showInfo("adViewDidFailToReceiveAdWithError name=" + t + " msg=" + i)
                                 },
                                 adViewWillPresentScreen: function(t) {
                                    e.showInfo("adViewWillPresentScreen name=" + t)
                                 },
                                 adViewDidDismissScreen: function(t) {
                                     e.showInfo("adViewDidDismissScreen name=" + t)
                                 },
                                 adViewWillDismissScreen: function(t) {
                                     e.showInfo("adViewWillDismissScreen=" + t)
                                 },
                                 adViewWillLeaveApplication: function(t) {
                                     e.showInfo("adViewWillLeaveApplication=" + t)
                                 }
                            }), sdkbox.PluginAdMob.init()
                         }
                     },

i use iPhone debug for mac safari . but error “ReferenceError: Can’t find variable: sdkbox”

I build for web-mobile and android.
occur error cannot play game.
i want to use Admob.

Cocos Creator Ver:1.6.1
mac OS:10.13.3
sdkbox: 1.0.1.32
sdkbox GUI:1.1.5

please help(;_;)

Try to add the below to AppDelegate.cpp in appropriate places because this is a common reason for such an error.

#ifdef SDKBOX_ENABLED
#include “PluginAdMobJS.hpp”
#include “PluginAdMobJSHelper.h”
#endif

#ifdef SDKBOX_ENABLED
se->addRegisterCallback(register_all_PluginAdMobJS);
se->addRegisterCallback(register_all_PluginAdMobJS_helper);
#endif

Actually, I just reread and see sdkbox is missing. The last reply is for admob not being found. Chances are you can’t run tests in Safari. I recommend the simulator which works with Xcode.

ota thanks!!

but i added to AppDelegate.cpp…orz

sorry, debug for Xcode is successfully!!
but compile for android is failed.

i try compile for android but error

Building mode: debug
Using Android Studio project : /Users/USERNAME/runko/build/jsb-default/frameworks/runtime-src/proj.android-studio
Building native…
NDK build mode: debug
running: ‘/Users/USERNAME/android-ndk-r14b/ndk-build -C /Users/USERNAME/runko/build/jsb-default/frameworks/runtime-src/proj.android-studio/app -j4 NDK_MODULE_PATH=/Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x:/Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos:/Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/external NDK_TOOLCHAIN_VERSION=4.9 NDK_DEBUG=1’

Android NDK: WARNING: Unsupported source file extensions in jni/Android.mk for module cocos2djs_shared
Android NDK: …/…/…/Classes/PluginSdkboxAdsJS.hpp …/…/…/Classes/PluginSdkboxAdsJSHelper.h …/…/…/Classes/SDKBoxJSHelper.h …/…/…/Classes/PluginGoogleAnalyticsJS.hpp
make: Entering directory /Users/USERNAME/runko/build/jsb-default/frameworks/runtime-src/proj.android-studio/app' ・ ・ ・ jni/../../../Classes/PluginIAPJSHelper.cpp: In function 'void product_to_obj(JSContext*, const sdkbox::Product&, JS::MutableHandleObject)': jni/../../../Classes/PluginIAPJSHelper.cpp:37:55: warning: 'short unsigned int* cocos2d::cc_utf8_to_utf16(const char*, int, int*)' is deprecated (declared at /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/network/../base/ccUTF8.h:292) [-Wdeprecated-declarations] const char16_t *chars = (const char16_t*)cocos2d::cc_utf8_to_utf16(p.price.c_str()); ^ jni/../../../Classes/PluginIAPJSHelper.cpp:37:87: warning: 'short unsigned int* cocos2d::cc_utf8_to_utf16(const char*, int, int*)' is deprecated (declared at /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/network/../base/ccUTF8.h:292) [-Wdeprecated-declarations] const char16_t *chars = (const char16_t*)cocos2d::cc_utf8_to_utf16(p.price.c_str()); ^ ・ ・ ・ [armeabi-v7a] Compile++ arm : cocos2dx_internal_static <= CCConsole.cpp [armeabi-v7a] Compile++ arm : cocos2dx_internal_static <= CCData.cpp /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/base/CCConsole.cpp:57:0: warning: "bzero" redefined #define bzero(a, b) memset(a, 0, b); ^ In file included from /Users/USERNAME/android-ndk-r14b/platforms/android-9/arch-arm/usr/include/stdlib.h:42:0, from /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/platform/android/CCStdC-android.h:38, from /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/platform/CCStdC.h:36, from /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/base/ccMacros.h:36, from /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/base/CCConsole.h:51, from /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/base/CCConsole.cpp:25: /Users/USERNAME/android-ndk-r14b/platforms/android-9/arch-arm/usr/include/strings.h:47:0: note: this is the location of the previous definition #define bzero(b, len) (void)(__builtin_memset((b), '\0', (len))) ^ [armeabi-v7a] Compile++ arm : cocos2dx_internal_static <= CCDirector.cpp [armeabi-v7a] Compile++ arm : cocos2dx_internal_static <= CCEvent.cpp [armeabi-v7a] Compile++ arm : cocos2dx_internal_static <= CCEventAcceleration.cpp [armeabi-v7a] Compile++ arm : cocos2dx_internal_static <= CCEventCustom.cpp ・ ・ ・ [armeabi-v7a] Compile++ thumb: cocos2dxandroid_static <= javaactivity-android.cpp [armeabi-v7a] Compile++ thumb: cocos2dxandroid_static <= Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp [armeabi-v7a] Compile++ thumb: cocos2dxandroid_static <= Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp [armeabi-v7a] Compile++ thumb: cocos2dxandroid_static <= Java_org_cocos2dx_lib_Cocos2dxHelper.cpp /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/platform/android/javaactivity-android.cpp: In function 'void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv*, jobject, jint, jint)': /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/platform/android/javaactivity-android.cpp:102:34: warning: 'void cocos2d::DrawPrimitives::init()' is deprecated (declared at /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/platform/android/../../2d/CCDrawingPrimitives.h:88) [-Wdeprecated-declarations] cocos2d::DrawPrimitives::init(); ^ /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/platform/android/javaactivity-android.cpp:102:39: warning: 'void cocos2d::DrawPrimitives::init()' is deprecated (declared at /Users/USERNAME/runko/build/jsb-default/frameworks/cocos2d-x/cocos/platform/android/../../2d/CCDrawingPrimitives.h:88) [-Wdeprecated-declarations] cocos2d::DrawPrimitives::init(); ^ [armeabi-v7a] Compile++ thumb: cocos2dxandroid_static <= Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp [armeabi-v7a] Compile++ thumb: cocos2dxandroid_static <= JniHelper.cpp ・ ・ ・ [armeabi-v7a] StaticLibrary : libcocos2dandroid.a [armeabi-v7a] SharedLibrary : libcocos2djs.so jni/../../../Classes/PluginSdkboxAdsJS.cpp:92: error: undefined reference to 'sdkbox::PluginSdkboxAds::hideAd(std::string const&, std::string const&)' jni/../../../Classes/PluginSdkboxAdsJS.cpp:127: error: undefined reference to 'sdkbox::PluginSdkboxAds::hide(std::string const&)' jni/../../../Classes/PluginSdkboxAdsJS.cpp:160: error: undefined reference to 'sdkbox::PluginSdkboxAds::placement(std::string const&)' jni/../../../Classes/PluginSdkboxAdsJS.cpp:189: error: undefined reference to 'sdkbox::PluginSdkboxAds::init()' jni/../../../Classes/PluginSdkboxAdsJS.cpp:217: error: undefined reference to 'sdkbox::PluginSdkboxAds::isAvailable(std::string const&)' jni/../../../Classes/PluginSdkboxAdsJS.cpp:456: error: undefined reference to 'sdkbox::setProjectType(char const*)' jni/../../../Classes/PluginSdkboxAdsJSHelper.cpp:105: error: undefined reference to 'sdkbox::PluginSdkboxAds::setListener(sdkbox::PluginSdkboxAdsListener*)' jni/../../../Classes/PluginSdkboxAdsJSHelper.cpp:136: error: undefined reference to 'sdkbox::PluginSdkboxAds::playAd(std::string const&, std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' jni/../../../Classes/PluginSdkboxAdsJSHelper.cpp:152: error: undefined reference to 'sdkbox::PluginSdkboxAds::playAd(std::string const&, std::string const&)' jni/../../../Classes/PluginSdkboxAdsJSHelper.cpp:158: error: undefined reference to 'sdkbox::PluginSdkboxAds::playAd(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' jni/../../../Classes/PluginSdkboxAdsJSHelper.cpp:164: error: undefined reference to 'sdkbox::PluginSdkboxAds::playAd()' jni/../../../Classes/PluginSdkboxAdsJSHelper.cpp:189: error: undefined reference to 'sdkbox::PluginSdkboxAds::cacheControl(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:92: error: undefined reference to 'sdkbox::PluginSdkboxPlay::incrementAchievement(std::string const&, double)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:123: error: undefined reference to 'sdkbox::PluginSdkboxPlay::getPlayerId()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:159: error: undefined reference to 'sdkbox::PluginSdkboxPlay::getMyScore(std::string const&, int, int)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:192: error: undefined reference to 'sdkbox::PluginSdkboxPlay::showAllLeaderboards()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:220: error: undefined reference to 'sdkbox::PluginSdkboxPlay::getPlayerAccountField(std::string const&)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:253: error: undefined reference to 'sdkbox::PluginSdkboxPlay::loadAllData()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:287: error: undefined reference to 'sdkbox::PluginSdkboxPlay::getPlayerCenteredScores(std::string const&, int, int, int)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:323: error: undefined reference to 'sdkbox::PluginSdkboxPlay::showLeaderboard(std::string const&)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:331: error: undefined reference to 'sdkbox::PluginSdkboxPlay::showLeaderboard(std::string const&)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:365: error: undefined reference to 'sdkbox::PluginSdkboxPlay::signout()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:389: error: undefined reference to 'sdkbox::PluginSdkboxPlay::isSignedIn()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:417: error: undefined reference to 'sdkbox::PluginSdkboxPlay::init()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:449: error: undefined reference to 'sdkbox::PluginSdkboxPlay::unlockAchievement(std::string const&)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:482: error: undefined reference to 'sdkbox::PluginSdkboxPlay::loadAchievements(bool)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:515: error: undefined reference to 'sdkbox::PluginSdkboxPlay::loadGameData(std::string const&)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:544: error: undefined reference to 'sdkbox::PluginSdkboxPlay::showAchievements()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:568: error: undefined reference to 'sdkbox::PluginSdkboxPlay::resetAchievements()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:592: error: undefined reference to 'sdkbox::PluginSdkboxPlay::isConnected()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:626: error: undefined reference to 'sdkbox::PluginSdkboxPlay::submitScore(std::string const&, long)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:663: error: undefined reference to 'sdkbox::PluginSdkboxPlay::setSteps(std::string const&, double)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:694: error: undefined reference to 'sdkbox::PluginSdkboxPlay::getVersion()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:722: error: undefined reference to 'sdkbox::PluginSdkboxPlay::removeListener()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:746: error: undefined reference to 'sdkbox::PluginSdkboxPlay::loadAllGameData()' jni/../../../Classes/PluginSdkboxPlayJS.cpp:774: error: undefined reference to 'sdkbox::PluginSdkboxPlay::reveal(std::string const&)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:809: error: undefined reference to 'sdkbox::PluginSdkboxPlay::saveGameData(std::string const&, std::string const&)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:841: error: undefined reference to 'sdkbox::PluginSdkboxPlay::signin(bool)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:849: error: undefined reference to 'sdkbox::PluginSdkboxPlay::signin(bool)' jni/../../../Classes/PluginSdkboxPlayJS.cpp:1149: error: undefined reference to 'sdkbox::setProjectType(char const*)' jni/../../../Classes/PluginSdkboxPlayJSHelper.cpp:361: error: undefined reference to 'sdkbox::PluginSdkboxPlay::getListener()' jni/../../../Classes/PluginSdkboxPlayJSHelper.cpp:394: error: undefined reference to 'sdkbox::PluginSdkboxPlay::setListener(sdkbox::SdkboxPlayListener*)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:90: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::createTracker(std::string const&)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:125: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::setMetric(int, std::string const&)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:156: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::stopPeriodicalDispatch()' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:184: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::logECommerce(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:217: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::setDryRun(bool)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:256: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::logEvent(std::string const&, std::string const&, std::string const&, int)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:295: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::enableExceptionReporting(bool)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:328: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::dispatchPeriodically(int)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:358: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::init(char const*)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:366: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::init(char const*)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:404: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::logScreen(std::string const&)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:433: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::startSession()' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:463: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::logException(std::string const&, bool)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:498: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::setUser(std::string const&)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:527: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::stopSession()' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:557: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::setDimension(int, std::string const&)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:596: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::logSocial(std::string const&, std::string const&, std::string const&)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:633: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::enableAdvertisingTracking(bool)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:662: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::dispatchHits()' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:690: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::enableTracker(std::string const&)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:729: error: undefined reference to 'sdkbox::PluginGoogleAnalytics::logTiming(std::string const&, int, std::string const&, std::string const&)' jni/../../../Classes/PluginGoogleAnalyticsJS.cpp:1015: error: undefined reference to 'sdkbox::setProjectType(char const*)' jni/../../../Classes/PluginAdMobJS.cpp:87: error: undefined reference to 'sdkbox::PluginAdMob::getCurrBannerHeight(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:97: error: undefined reference to 'sdkbox::PluginAdMob::getCurrBannerHeight(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:138: error: undefined reference to 'sdkbox::PluginAdMob::getCurrBannerHeightInPixel(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:148: error: undefined reference to 'sdkbox::PluginAdMob::getCurrBannerHeightInPixel(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:192: error: undefined reference to 'sdkbox::PluginAdMob::hide(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:225: error: undefined reference to 'sdkbox::PluginAdMob::setTestDevices(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:258: error: undefined reference to 'sdkbox::PluginAdMob::show(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:288: error: undefined reference to 'sdkbox::PluginAdMob::getCurrBannerWidthInPixel(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:298: error: undefined reference to 'sdkbox::PluginAdMob::getCurrBannerWidthInPixel(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:342: error: undefined reference to 'sdkbox::PluginAdMob::cache(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:372: error: undefined reference to 'sdkbox::PluginAdMob::getCurrBannerWidth(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:382: error: undefined reference to 'sdkbox::PluginAdMob::getCurrBannerWidth(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:422: error: undefined reference to 'sdkbox::PluginAdMob::init()' jni/../../../Classes/PluginAdMobJS.cpp:450: error: undefined reference to 'sdkbox::PluginAdMob::getVersion()' jni/../../../Classes/PluginAdMobJS.cpp:482: error: undefined reference to 'sdkbox::PluginAdMob::isAvailable(std::string const&)' jni/../../../Classes/PluginAdMobJS.cpp:739: error: undefined reference to 'sdkbox::setProjectType(char const*)' jni/../../../Classes/PluginAdMobJSHelper.cpp:191: error: undefined reference to 'sdkbox::PluginAdMob::getListener()' jni/../../../Classes/PluginAdMobJSHelper.cpp:224: error: undefined reference to 'sdkbox::PluginAdMob::setListener(sdkbox::AdMobListener*)' jni/../../../Classes/PluginIAPJS.cpp:90: error: undefined reference to 'sdkbox::IAP::purchase(std::string const&)' jni/../../../Classes/PluginIAPJS.cpp:125: error: undefined reference to 'sdkbox::IAP::updateStorePromotionVisibility(std::string const&, bool)' jni/../../../Classes/PluginIAPJS.cpp:160: error: undefined reference to 'sdkbox::IAP::updateStorePromotionOrder(std::vector<std::string, std::allocator<std::string> > const&)' jni/../../../Classes/PluginIAPJS.cpp:189: error: undefined reference to 'sdkbox::IAP::restore()' jni/../../../Classes/PluginIAPJS.cpp:213: error: undefined reference to 'sdkbox::IAP::isAutoFinishTransaction()' jni/../../../Classes/PluginIAPJS.cpp:241: error: undefined reference to 'sdkbox::IAP::fetchStorePromotionOrder()' jni/../../../Classes/PluginIAPJS.cpp:265: error: undefined reference to 'sdkbox::IAP::refresh()' jni/../../../Classes/PluginIAPJS.cpp:293: error: undefined reference to 'sdkbox::IAP::fetchStorePromotionVisibility(std::string const&)' jni/../../../Classes/PluginIAPJS.cpp:326: error: undefined reference to 'sdkbox::IAP::setAutoFinishTransaction(bool)' jni/../../../Classes/PluginIAPJS.cpp:356: error: undefined reference to 'sdkbox::IAP::init(char const*)' jni/../../../Classes/PluginIAPJS.cpp:364: error: undefined reference to 'sdkbox::IAP::init(char const*)' jni/../../../Classes/PluginIAPJS.cpp:402: error: undefined reference to 'sdkbox::IAP::setDebug(bool)' jni/../../../Classes/PluginIAPJS.cpp:435: error: undefined reference to 'sdkbox::IAP::enableUserSideVerification(bool)' jni/../../../Classes/PluginIAPJS.cpp:468: error: undefined reference to 'sdkbox::IAP::finishTransaction(std::string)' jni/../../../Classes/PluginIAPJS.cpp:497: error: undefined reference to 'sdkbox::IAP::removeListener()' jni/../../../Classes/PluginIAPJSHelper.cpp:502: error: undefined reference to 'sdkbox::IAP::setListener(sdkbox::IAPListener*)' jni/../../../Classes/PluginIAPJSHelper.cpp:516: error: undefined reference to 'sdkbox::IAP::getProducts()' collect2: error: ld returned 1 exit status make: *** [obj/local/armeabi-v7a/libcocos2djs.so] Error 1 make: Leaving directory/Users/USERNAME/runko/build/jsb-default/frameworks/runtime-src/proj.android-studio/app’
Error running command, return code: 2.

I haven’t experienced similar errors. Did you try the iOS option? That should work easier for you. Testing on the simulator and Xcode will give you better results than the Safari simulator because it must be an app not the web version.

For Android, I recommend making sure that the Android settings are correct because you have to download and install NDK, Ant etc. Let me know if you did this? If not, I can give you the link to the instructions on the Cocos site. Your setup should look something like this:

Compile for iOS successfully!! thanks! because remove “System() method” .
Android, yes i did.
complied for android success until add SDKBOX.

Did you add the lines below in correct areas because looking at your error code it seems it is the problem.

This:

#ifdef SDKBOX_ENABLED
#include “PluginAdMobJS.hpp”
#include “PluginAdMobJSHelper.h”
#endif

#ifdef SDKBOX_ENABLED
se->addRegisterCallback(register_all_PluginAdMobJS);
se->addRegisterCallback(register_all_PluginAdMobJS_helper);
#endif

You add Admob via the SDK box extension. Make sure it’s up to date. Then add those lines in AppDelegate.cpp

Add:

#ifdef SDKBOX_ENABLED
#include “PluginAdMobJS.hpp”
#include “PluginAdMobJSHelper.h”
#endif

below:

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
#include "SDKManager.h"
#include "jsb_anysdk_protocols_auto.hpp"
#include "manualanysdkbindings.hpp"
using namespace anysdk::framework;
#endif

Add:

#ifdef SDKBOX_ENABLED
    se->addRegisterCallback(register_all_PluginAdMobJS);
    se->addRegisterCallback(register_all_PluginAdMobJS_helper);
#endif

below:

 se->setExceptionCallback([](const char* location, const char* message, const char* stack){
        // Send exception information to server like Tencent Bugly.

    });

    jsb_register_all_modules();

Look here:

http://docs.sdkbox.com/en/plugins/admob/v3-js/

Find this: Register Javascript Functions

This is my Admob:

 admobInit: function () {

        if (cc.sys.isMobile) {

            if ("undefined" == typeof (sdkbox)) {
                //console.log("sdkbox is not exist")
                //did not initialize

                return
            }

            if ("undefined" != typeof (sdkbox.PluginAdMob)) {
                
                sdkbox.PluginAdMob.init();
                sdkbox.PluginAdMob.cache(this.adType);

            } else {
                //did not initialize
            }

        } else {
            //did not initialize
        }
    },

I don’t use listeners… Only:

 properties: {
        // foo: {
        //    default: null,      // The default value will be used only when the component attaching
        //                           to a node for the first time
        //    url: cc.Texture2D,  // optional, default is typeof default
        //    serializable: true, // optional, default is true
        //    visible: true,      // optional, default is true
        //    displayName: 'Foo', // optional
        //    readonly: false,    // optional, default is false
        // },
        // ...
        adType: 'next_level',
    },

showAdmob: function () {

        //console.log('is paused');

        if (sdkbox.PluginAdMob.isAvailable(this.adType)) {

            sdkbox.PluginAdMob.show(this.adType);

        }
    },

Try without listeners just to see and add them later. Make sure “next_level” is in sdkconfig… Cache function can be removed if you are caching in sdkconfig I believe…

wrote AppDelegate.cpp…but compile failed

#include “AppDelegate.h”

#include “platform/CCGLView.h”

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include “platform/ios/CCGLViewImpl-ios.h”
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include “platform/android/CCGLViewImpl-android.h”
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#include “platform/desktop/CCGLViewImpl-desktop.h”
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#include “platform/desktop/CCGLViewImpl-desktop.h”
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_MAC

#include “base/CCDirector.h”
#include “base/CCEventDispatcher.h”

#include “js_module_register.h”
#ifdef SDKBOX_ENABLED
#include “PluginIAPJS.hpp”
#include “PluginIAPJSHelper.h”
#endif
#ifdef SDKBOX_ENABLED
#include “PluginGoogleAnalyticsJS.hpp”
//#include “PluginGoogleAnalyticsJSHelper.h”
#endif
#ifdef SDKBOX_ENABLED
#include “PluginSdkboxPlayJS.hpp”
#include “PluginSdkboxPlayJSHelper.h”
#endif
#ifdef SDKBOX_ENABLED
#include “PluginAdMobJS.hpp”
#include “PluginAdMobJSHelper.h”
#endif

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
#include “SDKManager.h”
#include “jsb_anysdk_protocols_auto.hpp”
#include “manualanysdkbindings.hpp”
using namespace anysdk::framework;
#endif

USING_NS_CC;

AppDelegate::AppDelegate()
{
}

AppDelegate::~AppDelegate()
{
ScriptEngineManager::destroyInstance();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
SDKManager::getInstance()->purge();
#endif
}

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

GLView::setGLContextAttrs(glContextAttrs);

}

bool AppDelegate::applicationDidFinishLaunching()
{
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS && PACKAGE_AS
SDKManager::getInstance()->loadAllPlugins();
#endif
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
#if(CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
glview = GLViewImpl::create(“RUNKO”);
#else
glview = GLViewImpl::createWithRect(“RUNKO”, Rect(0,0,900,640));
#endif
director->setOpenGLView(glview);
}

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

js_module_register();

ScriptingCore* sc = ScriptingCore::getInstance();

#ifdef SDKBOX_ENABLED
sc->addRegisterCallback(register_all_PluginIAPJS);
sc->addRegisterCallback(register_all_PluginIAPJS_helper);
#endif
#ifdef SDKBOX_ENABLED
sc->addRegisterCallback(register_all_PluginGoogleAnalyticsJS);
// sc->addRegisterCallback(register_all_PluginGoogleAnalyticsJS_helper);
// sc->addRegisterCallback(register_all_PluginIAPJS);
// sc->addRegisterCallback(register_all_PluginIAPJS_helper);
#endif
#ifdef SDKBOX_ENABLED
sc->addRegisterCallback(register_all_PluginSdkboxPlayJS);
sc->addRegisterCallback(register_all_PluginSdkboxPlayJS_helper);
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
sc->addRegisterCallback(register_all_anysdk_framework);
sc->addRegisterCallback(register_all_anysdk_manual);
#endif
#ifdef SDKBOX_ENABLED
sc->addRegisterCallback(register_all_PluginAdMobJS);
sc->addRegisterCallback(register_all_PluginAdMobJS_helper);
#endif
sc->setExceptionCallback([](const char* location, const char* message, const char* stack){
// Send exception information to server like Tencent Bugly.

});

jsb_register_all_modules();
ScriptEngineManager::getInstance()->setScriptEngine(sc);
sc->start();
sc->runScript("script/jsb_boot.js");
sc->runScript("main.js");

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”);
}

// 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”);
}

Are you using the Android Studio building process? This is what I use… Also try to update the SDK box modules, build, compile and then drop apk to phone… This is my process…

Also make sure gradle settings are correct and AndroidManifest.xml

I know it can be a pain at the beginning. I had some trouble with cocos and sdkbox in the beginning…

My file:

 #include "AppDelegate.h"

    #include "cocos2d.h"

    #include "cocos/scripting/js-bindings/manual/ScriptingCore.h"
    #include "cocos/scripting/js-bindings/manual/jsb_module_register.hpp"
    #include "cocos/scripting/js-bindings/manual/jsb_global.h"
    #include "cocos/scripting/js-bindings/jswrapper/SeApi.h"

    #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
    #include "SDKManager.h"
    #include "jsb_anysdk_protocols_auto.hpp"
    #include "manualanysdkbindings.hpp"
    using namespace anysdk::framework;
    #endif

    USING_NS_CC;
    #ifdef SDKBOX_ENABLED
    #include "PluginReviewJS.hpp"
    #include "PluginReviewJSHelper.h"
    #endif
    #ifdef SDKBOX_ENABLED
    #include "PluginIAPJS.hpp"
    #include "PluginIAPJSHelper.h"
    #endif
    #ifdef SDKBOX_ENABLED
    #include "PluginAdMobJS.hpp"
    #include "PluginAdMobJSHelper.h"
    #endif

    AppDelegate::AppDelegate()
    {
    }

    AppDelegate::~AppDelegate()
    {
        ScriptEngineManager::destroyInstance();
    #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
        SDKManager::getInstance()->purge();
    #endif
    }

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

    bool AppDelegate::applicationDidFinishLaunching()
    {
    #if CC_TARGET_PLATFORM == CC_PLATFORM_IOS && PACKAGE_AS
        SDKManager::getInstance()->loadAllPlugins();
    #endif
        // initialize director
        auto director = Director::getInstance();
        auto glview = director->getOpenGLView();
        if(!glview) {
    #if(CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
            glview = GLViewImpl::create("test");
    #else
            glview = GLViewImpl::createWithRect("test", cocos2d::Rect(0,0,900,640));
    #endif
            director->setOpenGLView(glview);
        }
        
        // set FPS. the default value is 1.0/60 if you don't call this
        director->setAnimationInterval(1.0 / 60);

        ScriptingCore* sc = ScriptingCore::getInstance();
        ScriptEngineManager::getInstance()->setScriptEngine(sc);

        se::ScriptEngine* se = se::ScriptEngine::getInstance();

        jsb_set_xxtea_key("236cab55-49cc-47");
        jsb_init_file_operation_delegate();

    #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
        // Enable debugger here
        jsb_enable_debugger("0.0.0.0", 5086);
    #endif

        se->setExceptionCallback([](const char* location, const char* message, const char* stack){
            // Send exception information to server like Tencent Bugly.

        });

        jsb_register_all_modules();
    #ifdef SDKBOX_ENABLED
        se->addRegisterCallback(register_all_PluginReviewJS);
        se->addRegisterCallback(register_all_PluginReviewJS_helper);
    #endif
    #ifdef SDKBOX_ENABLED
        se->addRegisterCallback(register_all_PluginIAPJS);
        se->addRegisterCallback(register_all_PluginIAPJS_helper);
    #endif
    #ifdef SDKBOX_ENABLED
        se->addRegisterCallback(register_all_PluginAdMobJS);
        se->addRegisterCallback(register_all_PluginAdMobJS_helper);
    #endif
    #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
        se->addRegisterCallback(register_all_anysdk_framework);
        se->addRegisterCallback(register_all_anysdk_manual);
    #endif

        se->start();

        jsb_run_script("main.js");

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

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

too thanks!!

i don’t use AndroidStudio.
use CocosCreator only.

I’ll try your file

I don’t think it’s good to paste the whole file because I don’t use the same SDK modules. Just compare that the SDK includes are in the correct place, format etc. I use Cocos Creator to build as well but I also have Android Studio installed. Make sure Android Studio is properly installed and that you have the correct platform in Cocos Creator gradle etc. I would also update the SDK modules because it seems based on the errors that the modules aren’t correctly installed.

mmm…
I try some way, but never successfully.
iOS build success, boot on my iPhone. display Ads!!!
but … now don’t display(;_;)

Sorry, I didn’t see this message. I actually came across a problem building as well… Usually deleting the build folder and doing rebuilding from scratch works… You probably fixed your problem by now but figured post this for others having problems…

Also I’ve noticed problems with SDK box if you have link set in the build editor window instead of default.