Search Unity

Bug Crash - AdMob - Launch/Suspend

Discussion in 'Unity Mediation' started by bearhugmo, May 8, 2022.

  1. bearhugmo

    bearhugmo

    Joined:
    Mar 20, 2019
    Posts:
    19
    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.

    Code (CSharp):
    1. CrashReporter Key:  aad8faa2cf7f5af1494e218ca01d937a12a64b7e
    2. Hardware Model:     iPhone9,4
    3. Process:            AliceLegends
    4. Identifier:         com.bhe.alicelegends
    5. Version:            3.3.0
    6. Role:               Foreground
    7. OS Version:         iOS 15.4.1
    8. Exception Type:     EXC_BAD_ACCESS
    9. Exception Subtype:  KERN_INVALID_TASK
    10.  
    11.  
    12. EXC_BAD_ACCESS: Attempted to dereference garbage pointer 0x10.
    13.  
    14. 0  UnityFramework   -[UADSTimer timesUp:]
    15. 1  Foundation       ___NSFireTimer
    16. 2  CoreFoundation   _CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION
    17. 3  CoreFoundation   ___CFRunLoopDoTimer
    18. 4  CoreFoundation   ___CFRunLoopDoTimers
    19. 5  CoreFoundation   ___CFRunLoopRun
    20. 6  CoreFoundation   _CFRunLoopRunSpecific
    21. 7  GraphicsServices _GSEventRunModal
    22. 8  UIKitCore        -[UIApplication _run]
    23. 9  UIKitCore        _UIApplicationMain
    24. 10 AliceLegends     -[UnityFramework runUIApplicationMainWithArgc:argv:] (main.mm:96:5)
    25. 11 AliceLegends     main (main.mm:26:9)
    Any insight into the cause or options to workaround would be greatly appreciated.
     
  2. DeclanMcPartlin

    DeclanMcPartlin

    Unity Technologies

    Joined:
    Nov 19, 2020
    Posts:
    146
    Hello @mobearhug, 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:
    Code (CSharp):
    1.  
    2. <dependencies>
    3.   <iosPods>
    4.     <iosPod name="UnityAds" version="4.1.0"/>
    5.   </iosPods>
    6. </dependencies>
    7.  
    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.
     
    bearhugmo likes this.
  3. bearhugmo

    bearhugmo

    Joined:
    Mar 20, 2019
    Posts:
    19
    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.
     
  4. DeclanMcPartlin

    DeclanMcPartlin

    Unity Technologies

    Joined:
    Nov 19, 2020
    Posts:
    146
    Brilliant @mobearhug, 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.
     
  5. DeclanMcPartlin

    DeclanMcPartlin

    Unity Technologies

    Joined:
    Nov 19, 2020
    Posts:
    146
    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.
     
    bearhugmo likes this.
  6. tataygames

    tataygames

    Joined:
    Aug 4, 2016
    Posts:
    55
    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,
     
    ZKlopper likes this.
  7. ZKlopper

    ZKlopper

    Joined:
    Oct 22, 2022
    Posts:
    1
    The same problem !
     
  8. jcGrenier

    jcGrenier

    Unity Technologies

    Joined:
    Feb 23, 2021
    Posts:
    145
    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.
     
    HademLight likes this.