Crash - AdMob - Launch/Suspend

I am in the process of moving from AdMob to Unity as a mediator for our ads. I am seeing stability issues on iOS that are not present on our Android builds.

There are currently 2 crashes that occur only with AdMob adaptor added. (No crashing with Unity/Audience Network.)

  1. Immediate crash on first launch (subsequent launches do not crash)
  2. Crash immediately after returning to the app after it has been suspended.

I should make it clear that AdMob ads are successfully delivered and shown throughout the lifecycle of the app otherwise.

All native SDKs have been removed as per the integration instructions of the SDK.

Below is the call stack for crashes in case 2 above.

CrashReporter Key:  aad8faa2cf7f5af1494e218ca01d937a12a64b7e
Hardware Model:     iPhone9,4
Process:            AliceLegends
Identifier:         com.bhe.alicelegends
Version:            3.3.0
Role:               Foreground
OS Version:         iOS 15.4.1
Exception Type:     EXC_BAD_ACCESS
Exception Subtype:  KERN_INVALID_TASK


EXC_BAD_ACCESS: Attempted to dereference garbage pointer 0x10.

0  UnityFramework   -[UADSTimer timesUp:]
1  Foundation       ___NSFireTimer
2  CoreFoundation   _CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION
3  CoreFoundation   ___CFRunLoopDoTimer
4  CoreFoundation   ___CFRunLoopDoTimers
5  CoreFoundation   ___CFRunLoopRun
6  CoreFoundation   _CFRunLoopRunSpecific
7  GraphicsServices _GSEventRunModal
8  UIKitCore        -[UIApplication _run]
9  UIKitCore        _UIApplicationMain
10 AliceLegends     -[UnityFramework runUIApplicationMainWithArgc:argv:] (main.mm:96:5)
11 AliceLegends     main (main.mm:26:9)

Any insight into the cause or options to workaround would be greatly appreciated.

Hello @bearhugmo , thank you for reporting this. This actually seems to be tied to a very recent Unity Ads release (4.2.0) that is causing it. For now, our recommended solution is to create a file called OverrideDependencies.xml and add it to your project at this location: Assets/Editor.

The contents of the XML should be this:

<dependencies>
  <iosPods>
    <iosPod name="UnityAds" version="4.1.0"/>
  </iosPods>
</dependencies>

This will force Unity Ads to install the last stable version. Once a patch release is ready for Unity Ads 4.2, this file will not be required anymore.

Let us know if this solves the problem for you, thanks.

1 Like

I can confirm that the workaround does fix the issue. Thanks.

I’m really impressed with the support this Mediation layer is getting.
This work is making my life so much easier.

Brilliant @bearhugmo , thank you for the kind words and letting us know this solution fixes the issue for you.

The Unity Ads SDK will release a patch version very shortly to fix this issue, we will provide an update when that new version is ready.

An update on this: The Unity Ads team have released a new patch version 4.2.1 to tackle this issue. The Override XML above is no longer required.

1 Like

Im using unity 2020.3.43 and using admob 4.2.0
and when I build in android and test he app it crashes at start,

1 Like

The same problem !

Hi @tataygames and @ZKlopper ,
You can check the android logs for the cause of the crash, but most likely that would be because you did not include your admob app id in the mediated networks settings.
This is unfortunately how the admob lib works, it crashes on launch if the app id is incorrect.

1 Like