GADInvalidInitializationException after upgrade to Unity 2020.3.1f1

Hello, community!

I’ve been fighting an issue for 2 days now.

What I had:
A mobile app built with Unity 2020.1.17 with AdMob & FacebookSDK installed.
Everything worked like a charm until I updated to Unity 2020.3.1f1 LTS and updated CocoaPods to 1.10.1.

I figured it out when I tried launching on a test device.
I got an error (in Unity Editor):

Analyzing dependencies
[!] `GoogleAppMeasurement` requires CocoaPods version `>= 1.10.0`, which is not satisfied by your current version, `1.9.3`.

I installed the latest stable version of CocoaPods, 1.10.1.
At that point, I had 2 versions of CocoaPods and the app started to build successfully in the editor.
There were no compilation errors in XCode, but when the app launched I started getting an error:

Uncaught exception: GADInvalidInitializationException: The Google Mobile Ads SDK was initialized without AppMeasurement. Google AdMob publishers, follow instructions here: https://googlemobileadssdk.page.link/admob-ios-update-plist to include the AppMeasurement framework and set the -ObjC linker flag.

*** Terminating app due to uncaught exception 'GADInvalidInitializationException', reason: 'The Google Mobile Ads SDK was initialized without AppMeasurement. Google AdMob publishers, follow instructions here: https://googlemobileadssdk.page.link/admob-ios-update-plist to include the AppMeasurement framework and set the -ObjC linker flag. Google Ad Manager publishers, follow instructions here: https://googlemobileadssdk.page.link/ad-manager-ios-update-plist'
terminating with uncaught exception of type NSException
(lldb)

And here’s when it gets fun.
AdMob is set up correctly and the app used to work with no issues. Everything described in the suggested solution didn’t work as everything is already set. Frameworks and libraries are present in the xCode project.

The only solution that resolves the issue is the removal of FacebookSDK, but it’s not an option for me.
I tried reverting to Unity 2020.1.17 but with no success, still getting the same exception when the app launches on a device.

I tried the removal of Unity 2020.1.17. Some threads suggested that 2 versions on one machine can cause issues. Didn’t help.

Any thoughts?

After several hours of try/fail, I fixed the issue.

It worth saying I tried installing the older version of cocoapods and using it with prev version of Unity.
The idea was to revert all changes I did since updating Unity to 2020.3.1. Nothing helped.

The fix is in Enabling Ads Manager in AdMob settings.
As it worked before I updated Unity to 2020.3.1 and cocoapods, I think something has changed in the module cocoapods provided after an update. Probably before the update dependent modules were cached and xCode project used an older version.

1 Like