Reward video c++ crash

241 views
Skip to first unread message

Felipe Pessoa

unread,
May 19, 2017, 12:06:53 PM5/19/17
to Google Mobile Ads SDK Developers
Hello

I'm implementing rewarded video on my application in c++ on android. I`m using cocos2dx and Firebase 3.17.0.

In general, it's working fine. I've implemented the reward to try to load an ad until it has one ready for the user to watch. 
When the phone running the app loses connection to the internet, it keeps going on and on, and as far as I can tell, that doesn't generate any error.
The problem is when I keep pressing repeatedly the back button on the android phone, that's when the app crashes.

This is where it happens:

inline void FutureBase::Release() {
if (api_ != NULL) { // NOLINT
api_->ReleaseFuture(handle_); <------- on this line
api_ = NULL; // NOLINT
}
}

Callstack:

tgkill
pthread_kill
raise
__libc_android_abort
abort
firebase::DefaultLogCallback(firebase::LogLevel, const char *, void *)
firebase::LogMessageWithCallbackV(firebase::LogLevel, const char *, va_list)
firebase::LogAssert(char const*, ...)
firebase::ReferenceCountedFutureImpl::CompleteHandle(unsigned int)
firebase::FutureBase::Release() future_impl.h:111
firebase::ReferenceCountedFutureImpl::CompleteHandle(unsigned int)
firebase::ReferenceCountedFutureImpl::CompleteHandle(unsigned int)
firebase::admob::(anonymous)(JNIEnv *, jlong, jint, jstring, jclass)

This is the log:
1 - D/cocos2d-x debug info: reinitRewardedVideoAd
2 - D/Cocos2dxActivity: onWindowFocusChanged() hasFocus=false
3 - W/firebase: Future with handle 3 still exists though its backing API 0xB74F7E64 is being deleted. Please call Future::Release() before deleting the backing API. 
4 - D/cocos2d-x debug info: initRewardedVideoAd
5 - E/firebase: firebase::App __FIRAPP_DEFAULT already created, options will not be applied.
6 - W/firebase: AdMob is already initialized.
7 - A/firebase: it != backings_.end()

It's probably related to the 3rd line (which is probably related to the last line), because that's the api_ variable address and the handle_ value when it crashed. 

Here's my code:

static void initRewardedVideoAd()
{
log("initRewardedVideoAd");
isRewardedAdInitialized=false;
#if IS_ANDROID()
// Initialize Firebase for Android.
firebase::App *app=firebase::App::Create(cocos2d::JniHelper::getEnv(), cocos2d::JniHelper::getActivity());
firebase::admob::Initialize(*app, "INSERT_YOUR_ADMOB_ANDROID_APP_ID");
#endif//IS_ANDROID()
firebase::admob::rewarded_video::Initialize();
firebase::admob::rewarded_video::InitializeLastResult().OnCompletion(onRewardedVideoInitializeCompletionCallback, SCENE_SELF);
}

static void reinitRewardedVideoAd()
{
log("reinitRewardedVideoAd");
firebase::admob::rewarded_video::Destroy();
initRewardedVideoAd();
}

Should I do something before Destroy()? Or maybe there's another way of doing it without calling Destroy()?

Thanks in advance,

Felipe.

Bharani Cherukuri (MobileAds SDK Team)

unread,
May 19, 2017, 4:21:29 PM5/19/17
to Google Mobile Ads SDK Developers
Hello Felipe, 

Thank you for contacting us. Would you be able to provide us with some additional information regarding the crash, to investigate further on our end.
  • Device logs when the crash occurred
  • Can you check if you're able to replicate the issue with our sample apps?
  • Also, if you could provide us a sample code of your implementation or code snippets, it would be really helpful.
Regards,
Bharani Cherukuri
Mobile Ads SDK Team

Bharani Cherukuri (MobileAds SDK Team)

unread,
May 31, 2017, 4:13:38 PM5/31/17
to Google Mobile Ads SDK Developers
Hello Felipe, 

If you're still seeing a crash on loading the rewarded video ads, do provide us with the information requested above, it helps us investigate the issue further on our end.

Thanks,
Bharani Cherukuri
Mobile Ads SDK Team

On Friday, May 19, 2017 at 12:06:53 PM UTC-4, Felipe Pessoa wrote:
Reply all
Reply to author
Forward
0 new messages