Solvedflutterfire [firebase_admob 0.11.0+1] XCode Build Fails: Google-Mobile-Ads-SDK-fjgkwjemgangjofelixrcilvndtg

Bug report

I can't run my app after update firebase_admob from 0.10.3 to 0.11.0+1

Here is the output of build process:

Xcode build done.                                           29.5s
Failed to build iOS app
Error output from Xcode build:

    ** BUILD FAILED **
Xcode's output:

    Google-Mobile-Ads-SDK-fjgkwjemgangjofelixrcilvndtg
    In file included from /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:5:
    In file included from /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.h:6:
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTFirebaseAdMobPlugin.h:28:4: error: expected a type
    - (GADUnifiedNativeAdView *)createNativeAd:(GADUnifiedNativeAd *)nativeAd
       ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTFirebaseAdMobPlugin.h:28:45: error: expected a type
    - (GADUnifiedNativeAdView *)createNativeAd:(GADUnifiedNativeAd *)nativeAd
                                                ^
    In file included from /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:5:
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.h:39:45: error: no type or protocol named 'GADInterstitialDelegate'
    @interface FLTInterstitialAd : FLTMobileAd <GADInterstitialDelegate>
                                                ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.h:44:28: error: no type or protocol named 'GADUnifiedNativeAdLoaderDelegate'
        : FLTMobileAdWithView <GADUnifiedNativeAdLoaderDelegate, GADUnifiedNativeAdDelegate>
                               ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:39:17: error: no known class method for selector 'configureWithApplicationID:'
      [GADMobileAds configureWithApplicationID:appId];
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:97:79: warning: implicit conversion loses integer precision: 'FLTMobileAdStatus' to 'int' [-Wshorten-64-to-32]
      NSString *statusString = (NSString *)statusToString[[NSNumber numberWithInt:_status]];
                                                          ~                       ^~~~~~~
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:211:69: error: expected a type
    - (void)adView:(GADBannerView *)adView didFailToReceiveAdWithError:(GADRequestError *)error {
                                                                        ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:242:3: error: unknown type name 'GADInterstitial'; did you mean 'GADInterstitialAd'?
      GADInterstitial *_interstitial;
      ^~~~~~~~~~~~~~~
      GADInterstitialAd
    In module 'GoogleMobileAds' imported from /Users/user/Desktop/Flutter/memorie/ios/Pods/Headers/Public/Firebase/Firebase.h:125:
    /Users/user/Desktop/Flutter/memorie/build/ios/Debug-iphoneos/XCFrameworkIntermediates/GoogleMobileAds/GoogleMobileAds.framework/Headers/GADInterstitialAd.h:28:12: note: 'GADInterstitialAd' declared here
    @interface GADInterstitialAd : NSObject <GADFullScreenPresentingAd>
               ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:271:35: error: expected a type
    - (void)interstitialDidReceiveAd:(GADInterstitial *)ad {
                                      ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:278:23: error: expected a type
    - (void)interstitial:(GADInterstitial *)ad didFailToReceiveAdWithError:(GADRequestError *)error {
                          ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:278:73: error: expected a type
    - (void)interstitial:(GADInterstitial *)ad didFailToReceiveAdWithError:(GADRequestError *)error {
                                                                            ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:284:40: error: expected a type
    - (void)interstitialWillPresentScreen:(GADInterstitial *)ad {
                                           ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:288:40: error: expected a type
    - (void)interstitialWillDismissScreen:(GADInterstitial *)ad {
                                           ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:292:39: error: expected a type
    - (void)interstitialDidDismissScreen:(GADInterstitial *)ad {
                                          ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:296:43: error: expected a type
    - (void)interstitialWillLeaveApplication:(GADInterstitial *)ad {
                                              ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:255:21: error: unknown receiver 'GADInterstitial'; did you mean 'GADInterstitialAd'?
      _interstitial = [[GADInterstitial alloc] initWithAdUnitID:adUnitId];
                        ^~~~~~~~~~~~~~~
                        GADInterstitialAd
    In module 'GoogleMobileAds' imported from /Users/user/Desktop/Flutter/memorie/ios/Pods/Headers/Public/Firebase/Firebase.h:125:
    /Users/user/Desktop/Flutter/memorie/build/ios/Debug-iphoneos/XCFrameworkIntermediates/GoogleMobileAds/GoogleMobileAds.framework/Headers/GADInterstitialAd.h:28:12: note: 'GADInterstitialAd' declared here
    @interface GADInterstitialAd : NSObject <GADFullScreenPresentingAd>
               ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:255:44: error: no visible @interface for 'GADInterstitialAd' declares the selector 'initWithAdUnitID:'
      _interstitial = [[GADInterstitial alloc] initWithAdUnitID:adUnitId];
                       ~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:256:17: error: property 'delegate' not found on object of type 'GADInterstitialAd *'
      _interstitial.delegate = self;
                    ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:258:18: error: no visible @interface for 'GADInterstitialAd' declares the selector 'loadRequest:'
      [_interstitial loadRequest:[factory createRequest]];
       ~~~~~~~~~~~~~ ^~~~~~~~~~~
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTMobileAd.m:313:3: error: unknown type name 'GADUnifiedNativeAdView'; did you mean 'GADNativeAdView'?
      GADUnifiedNativeAdView *_nativeAd;
      ^~~~~~~~~~~~~~~~~~~~~~
      GADNativeAdView
    In module 'GoogleMobileAds' imported from /Users/user/Desktop/Flutter/memorie/ios/Pods/Headers/Public/Firebase/Firebase.h:125:
    /Users/user/Desktop/Flutter/memorie/build/ios/Debug-iphoneos/XCFrameworkIntermediates/GoogleMobileAds/GoogleMobileAds.framework/Headers/GADNativeAd.h:114:12: note: 'GADNativeAdView' declared here
    @interface GADNativeAdView : UIView
               ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    1 warning and 20 errors generated.
    In file included from /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTRequestFactory.m:6:
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTFirebaseAdMobPlugin.h:28:4: error: expected a type
    - (GADUnifiedNativeAdView *)createNativeAd:(GADUnifiedNativeAd *)nativeAd
       ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTFirebaseAdMobPlugin.h:28:45: error: expected a type
    - (GADUnifiedNativeAdView *)createNativeAd:(GADUnifiedNativeAd *)nativeAd
                                                ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTRequestFactory.m:71:13: error: property 'testDevices' not found on object of type 'GADRequest *'
        request.testDevices = testDevices;
                ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTRequestFactory.m:91:15: error: property 'birthday' not found on object of type 'GADRequest *'
          request.birthday =
                  ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTRequestFactory.m:106:19: error: property 'gender' not found on object of type 'GADRequest *'
              request.gender = genderValue;
                      ^
    /Users/user/Development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.11.0+1/ios/Classes/FLTRequestFactory.m:116:14: error: no visible @interface for 'GADRequest' declares the selector 'tagForChildDirectedTreatment:'
        [request tagForChildDirectedTreatment:childDirected.boolValue];
         ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    6 errors generated.
    Google-Mobile-Ads-SDK-fjgkwjemgangjofelixrcilvndtg
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
Could not build the precompiled application for the device.

Error launching application on iPhone.

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
flutter doctor -v

[] Flutter (Channel stable, 1.22.6, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-KH)
     Flutter version 1.22.6 at /Users/kuoyhout/Development/flutter
     Framework revision 9b2d32b605 (11 days ago), 2021-01-22 14:36:39 -0800
     Engine revision 2f0af37152
     Dart version 2.10.5

 
[] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
     Android SDK at /Users/kuoyhout/Library/Android/sdk
     Platform android-30, build-tools 30.0.2
     Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
     Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
     All Android licenses accepted.

[] Xcode - develop for iOS and macOS (Xcode 12.3)
     Xcode at /Applications/Xcode.app/Contents/Developer
     Xcode 12.3, Build version 12C33
     CocoaPods version 1.10.0

[] Android Studio (version 4.1)
     Android Studio at /Applications/Android Studio.app/Contents
     Flutter plugin installed
     Dart plugin version 201.9245
     Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[] VS Code (version 1.52.1)
     VS Code at /Applications/Visual Studio Code.app/Contents
     Flutter extension version 3.19.0

[] Connected device (1 available)
     iPhone (mobile)  00008030-00165D292639802E  ios  iOS 14.3

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
Dart SDK 2.10.5
Flutter SDK 1.22.6
memorie 1.0.0+5

dependencies:
- archive 2.0.13 [crypto args path]
- connectivity 2.0.2 [flutter meta connectivity_platform_interface connectivity_macos connectivity_for_web]
- cupertino_icons 1.0.0
- firebase_admob 0.11.0+1 [meta flutter firebase_core]
- firebase_analytics 7.0.1 [meta flutter firebase_core firebase_analytics_web firebase_analytics_platform_interface]
- firebase_core 0.7.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_crashlytics 0.4.0+1 [flutter stack_trace firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface]
- fl_chart 0.12.2 [flutter path_drawing equatable]
- fl_icloud 0.0.1 [flutter]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_local_notifications 4.0.0 [flutter flutter_local_notifications_platform_interface platform timezone]
- flutter_native_timezone 1.0.4 [flutter]
- flutter_riverpod 0.12.3 [collection flutter meta riverpod state_notifier]
- flutter_svg 0.19.1 [flutter meta path_drawing vector_math xml]
- google_sign_in 4.5.9 [google_sign_in_platform_interface flutter meta google_sign_in_web]
- googleapis 0.56.1 [_discoveryapis_commons http]
- in_app_review 1.0.4 [flutter in_app_review_platform_interface]
- jiffy 3.0.1 [intl]
- kt_dart 0.8.0 [meta]
- modal_bottom_sheet 1.0.0+1 [flutter]
- percent_indicator 2.1.9+1 [flutter]
- permission_handler 5.0.1+1 [flutter meta permission_handler_platform_interface]
- purchases_flutter 2.0.3 [flutter]
- shared_preferences 0.5.12+4 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- sqflite 1.3.2+2 [flutter sqflite_common path]
- table_calendar 2.3.3 [flutter intl simple_gesture_detector]
- url_launcher 5.7.10 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos url_launcher_windows]
- uuid 2.2.2 [crypto convert]

dev dependencies:
- flutter_launcher_icons 0.8.1 [image args yaml path]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]
- lint 1.3.0

transitive dependencies:
- _discoveryapis_commons 0.2.0 [http]
- args 1.6.0
- async 2.5.0-nullsafety.1 [collection]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- clock 1.1.0-nullsafety.1
- collection 1.15.0-nullsafety.3
- connectivity_for_web 0.3.1+4 [connectivity_platform_interface flutter_web_plugins flutter]
- connectivity_macos 0.1.0+7 [flutter]
- connectivity_platform_interface 1.0.6 [flutter meta plugin_platform_interface]
- convert 2.1.1 [charcode typed_data]
- crypto 2.1.5 [collection convert typed_data]
- equatable 1.2.5 [collection meta]
- fake_async 1.2.0-nullsafety.1 [clock collection]
- ffi 0.1.3
- file 5.2.1 [intl meta path]
- firebase 7.3.2 [http http_parser js]
- firebase_analytics_platform_interface 1.0.3 [flutter meta]
- firebase_analytics_web 0.1.1 [flutter flutter_web_plugins firebase firebase_analytics_platform_interface meta]
- firebase_core_platform_interface 3.0.1 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1+3 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- firebase_crashlytics_platform_interface 1.1.6 [flutter meta collection firebase_core plugin_platform_interface]
- flutter_local_notifications_platform_interface 2.0.0+1 [flutter plugin_platform_interface]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- freezed_annotation 0.12.0 [collection json_annotation meta]
- google_sign_in_platform_interface 1.1.2 [flutter meta quiver]
- google_sign_in_web 0.9.2 [google_sign_in_platform_interface flutter flutter_web_plugins meta js]
- http 0.12.2 [http_parser path pedantic]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image 2.1.19 [archive xml meta]
- in_app_review_platform_interface 1.0.5 [flutter url_launcher plugin_platform_interface platform]
- intl 0.16.1 [path]
- js 0.6.2
- json_annotation 3.1.1
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.3
- path 1.8.0-nullsafety.1
- path_drawing 0.4.1+1 [vector_math meta path_parsing flutter]
- path_parsing 0.1.4 [vector_math meta]
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_platform_interface 1.0.4 [flutter meta platform plugin_platform_interface]
- path_provider_windows 0.0.4+3 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.9.2 [meta]
- permission_handler_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- petitparser 3.1.0 [meta]
- platform 2.2.1
- plugin_platform_interface 1.0.3 [meta]
- process 3.0.13 [file intl meta path platform]
- quiver 2.1.5 [matcher meta]
- riverpod 0.12.3 [collection freezed_annotation meta state_notifier]
- shared_preferences_linux 0.0.2+4 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+11 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.4 [meta flutter]
- shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shared_preferences_windows 0.0.1+3 [shared_preferences_platform_interface flutter ffi file meta path path_provider_platform_interface path_provider_windows]
- simple_gesture_detector 0.1.5 [flutter]
- sky_engine 0.0.99
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- sqflite_common 1.0.3+1 [synchronized path meta]
- stack_trace 1.10.0-nullsafety.1 [path]
- state_notifier 0.6.0 [meta]
- stream_channel 2.1.0-nullsafety.1 [async]
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- synchronized 2.2.0+2
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timezone 0.6.1 [path]
- typed_data 1.3.0-nullsafety.3 [collection]
- url_launcher_linux 0.0.1+4 [flutter]
- url_launcher_macos 0.0.1+9 [flutter]
- url_launcher_platform_interface 1.0.9 [flutter meta plugin_platform_interface]
- url_launcher_web 0.1.5+1 [url_launcher_platform_interface flutter flutter_web_plugins meta]
- url_launcher_windows 0.0.1+3 [flutter]
- vector_math 2.1.0-nullsafety.3
- win32 1.7.4 [ffi]
- xdg_directories 0.1.2 [meta path process]
- xml 4.5.1 [collection convert meta petitparser]
- yaml 2.2.1 [charcode collection string_scanner source_span]

21 Answers

✔️Accepted Answer

Hey guys I think this is because AdMob recently updated their SDK to 8.0.0(because of this firebase_admob is resolving to 8.0.0...). I was able to get my project working by pinning Google-Mobile-Ads-SDK to version 7.69.0 in my Podfile. I don't actually use firebase_admob in that particular project because I import the SDK directly in my Podfile, I'm not sure how this could be overridden if you're using firebase_admob though.

Here's a StackOverflow answer about this:
https://stackoverflow.com/a/45322760

Maybe just try adding this to your Podfile, it's what ended up working for me in the project I was talking about above:

...
target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  # Try adding this
  pod 'Google-Mobile-Ads-SDK', '~> 7.69.0'
end

EDIT: You'll most likely also need to run the commands ahaboubi posted above too 👍

Other Answers:

made this work by using a combination of 2 solutions above :

1/ as @ThrowJojo said put this in your Podfile
pod 'Google-Mobile-Ads-SDK', '~> 7.69.0'
2/ don't forget to "pod update" after doing 1/

=> this works for me

Same error for me. I tried the below, but it didn't help:

flutter clean
rm ios/podfile.lock
rm ios/podfile
flutter pub get
pod update

Is there a dev branch we can using in our pubspec similar to the firebase_messaging: ^8.0.0-dev.14 Just to get it building for now?

I want to avoid using stuff like this as its easily forgotten.

  # TODO: remove this once this issue is resolved:
  # https://github.com/FirebaseExtended/flutterfire/issues/4931
  pod 'Google-Mobile-Ads-SDK', '~> 7.69.0'

More Issues: