Search code examples
iosfluttermobileadsgoogle-mobile-ads

Flutter iOS Build Fails with "Undefined Symbols" Error When Adding google_mobile_ads Plugin


I’m trying to integrate the google_mobile_ads plugin into my Flutter project, but the iOS build fails during the linking phase with the following error:

Error (Xcode): Undefined symbols: Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

The build works fine without the google_mobile_ads plugin, but as soon as I add it to my pubspec.yaml, the build fails. Here’s what I’ve tried so far:

Environment

Flutter Version: 3.27.1

Dart Version: 3.5.3

CocoaPods Version: 1.16.2

google_mobile_ads Version: 5.2.0

platform :ios, '14.0'

Steps Taken

  1. Updated Podfile:
  • Added pod 'Google-Mobile-Ads-SDK', '~> 11.10.0'.

  • Set the platform to ios, '14.0'.

  1. Verified Info.plist:
  • Added the GADApplicationIdentifier with my AdMob App ID:
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx</string>
  1. Linked Frameworks in Xcode:
  • Added GoogleMobileAds.framework to Frameworks, Libraries, and Embedded Content.

  • Set GoogleMobileAds.framework to Embed & Sign.

  1. Cleaned and Rebuilt:
  • Run flutter clean, flutter pub get, and flutter build ios.
  1. Reinstalled CocoaPods:
  • Deleted Podfile.lock and Pods/ directory.

  • Run pod install --repo-update.


Solution

  • You need to either upgrade Xcode to 15.3+ or downgrade google_mobile_ads to 5.1.0

    If downgrading, make sure to clean Flutter and reinstall pods afterwards.

    See https://github.com/googleads/googleads-mobile-flutter/issues/1185