Futter: Cannot find 'kGADAdSizeBanner' in scope


Error on iOS:

Cannot find 'kGADAdSizeBanner' in scope


private var adSize: GADAdSize = kGADAdSizeBanner



Extra info:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.0, on macOS 11.6.2 20G314 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.62.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

Android works.
Official Flutter package for ads (google_mobile_ads) is totally dead so changing to that one is not an option anymore.


Not sure if this will help but I faced this same issue. So I looked at the Banner-Ad size section from their documentation, and just made a custom GADAdsize var.

For example if you wanted a Large Banner(kGADAdSizeLargeBanner), then the documentation shows that the size in points (Width x Height) is 320×100.

Size for whatever reason we can’t access the variable kGADAdSizeLargeBanner (or kGADAdSizeBanner in your case) we can just create our own.

let adSize = GADAdSizeFromCGSize(CGSize(width: 320, height: 100))

Then using this adSize variable we can initialize a banner view.

let bannerView: GADBannerView = GADBannerView(adSize: adSize)

More detailed info about GADAdSizeFromCGSize can be found at this link.

Answered By – OneUpWallStreet

Answer Checked By – Cary Denson (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *