App crash when closing rewarded video ad

1,690 views
Skip to first unread message

Mobile Dev

unread,
Apr 10, 2017, 8:34:14 AM4/10/17
to Google Mobile Ads SDK Developers
HI everyone, I'm using Unity3d + C# + Admob rewarded videos (native, no mediation), target Android.

I use rewarded videos in two places of my game.

* In the main menu, to award diamonds to the player after watching a video. This works perfectly.
* After the player loses, there's an option to keep playing after watching a video. Here the app crash.

The code works like so:

 -An ads manager where other classes subscribe to public methods called by the ads callback
- A main menu manager, that subscribes to "OnAdLoaded" and "OnAdRewarded". Both callbacks work just fine. Main menu unsubscribes to the events once you start playing, and subscribes when you come back to it.
- An in game manager, that subscribes to "OnAdClosed" and "OnAdRewarded" when you start playing, and unsubscribes when you return to the main menu.

When you either close or complete the video, the app tries to come back and crashes  - force-closes (android 7) or restarts (android 6) - 
I get no error messages, I have a console that shows whatever I print (either with print(message) or Debug.Log(message)) inside the game, but crashes before it prints anything, I enclosed the call with a try-catch statement and a print(error.Message) but still crashes and prints no error, and using the logcat doesn't show anything (using logcat -s Unity) or it's extremely hard to find anything (without filtering)

I'm having a really hard time finding what's causing the error if I get no messages, can anyone throw me a hint on how to work on this? Thanks

Deepika Uragayala- MobileAds SDK team

unread,
Apr 10, 2017, 2:45:29 PM4/10/17
to Google Mobile Ads SDK Developers
Hi,

It looks like you might need to decouple the callback dependency in either of your managers and certainly it sounds like an implementation issue. Can you check the device logs via Android Studio? Build the APK on your device and run Android Studio and check for the device logs in the logcat. This would give you an idea on where it might be crashing from.

Regards,
Deepika Uragayala
Mobile Ads SDK Team

Jurassic Riders

unread,
Apr 10, 2017, 3:05:24 PM4/10/17
to google-adm...@googlegroups.com
Hi Deepika, you gotta be on the credits!

I know what it sounds, but the implementation is well done. I've been taking away bits of code to narrow where the crash would be.
After I found the conflicting piece of code, I found that the culprit was a NULL reference, now, the strange thing is that that piece of code was within a try-catch statement, but wasn't being catched. I blame C#/.NET/Unity 5.6 on this as the Admob SDK seems to work pretty stable thus far.

I wanted to run a few more tests before commenting here, but so far it seems that would be the issue.

Thanks again for your help :)

--

---
You received this message because you are subscribed to a topic in the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-admob-ads-sdk/nzVKx6AuBRE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages