Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target. #363

Closed
AnhTu6610 opened this issue Sep 4, 2021 · 27 comments
Labels
bug Something isn't working e3-weeks Effort: < 4 weeks p2-medium

Comments

@AnhTu6610
Copy link

AnhTu6610 commented Sep 4, 2021

Running Xcode build...                                                  
<Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
 └─Compiling, linking and signing...                         7.5s
Xcode build done.                                           34.4s
<Google> To get test ads on this device, set: GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = @[ kGADSimulatorID ];
flutter: |-->Language: vi                                               
<Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
Syncing files to device iPhone 12 Pro Max...                       411ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on iPhone 12 Pro Max is available at: http://127.0.0.1:53598/86K7-03DqdI=/
The Flutter DevTools debugger and profiler on iPhone 12 Pro Max is available at:
http://127.0.0.1:9101?uri=http%3A%2F%2F127.0.0.1%3A53598%2F86K7-03DqdI%3D%2F
flutter: |---> Route: /home
<Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
flutter: --------------> NativeAd failedToLoad: LoadAdError(code: 8, domain: com.google.admob, message: Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target., responseInfo: ResponseInfo(responseId: X0czYfSZENGtwgOm6bmIDg, mediationAdapterClassName: null, adapterResponses: [AdapterResponseInfo(adapterClassName: com.google.DummyAdapter, latencyMillis: 1), description: {
    Credentials =     {
    };
    Error = "Error Domain=com.google.admob Code=8 \"Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.\" UserInfo={NSLocalizedDescription=Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in th<…>
<Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
flutter: |---> Route: /detail
<Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
<Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
flutter: InterstitialAd failed to load: LoadAdError(code: 8, domain: com.google.admob, message: Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target., responseInfo: ResponseInfo(responseId: aUczYYj3BMixwgOEhbFg, mediationAdapterClassName: null, adapterResponses: [AdapterResponseInfo(adapterClassName: com.google.DummyAdapter, latencyMillis: 1), description: {
    Credentials =     {
    };
    Error = "Error Domain=com.google.admob Code=8 \"Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.\" UserInfo={NSLocalizedDescription=Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other L<…>
flutter: --------------> NativeAd failedToLoad: LoadAdError(code: 8, domain: com.google.admob, message: Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target., responseInfo: ResponseInfo(responseId: aUczYanUBZawvATU9oywAQ, mediationAdapterClassName: null, adapterResponses: [AdapterResponseInfo(adapterClassName: com.google.DummyAdapter, latencyMillis: 1), description: {
    Credentials =     {
    };
    Error = "Error Domain=com.google.admob Code=8 \"Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.\" UserInfo={NSLocalizedDescription=Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in th<…>
<Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.

@maheshmnj maheshmnj added the in triage Issue currently being evaluated label Sep 6, 2021
@maheshmnj
Copy link
Collaborator

maheshmnj commented Sep 6, 2021

Hi @AnhTu6610, Thanks for filing the issue. When filing issues please try to fill some or all of the information requested in the issue template. To investigate the issue further please share the output of flutter doctor -v and add some description and steps to reproduce the issue.
Also make sure you are using the correct ad units id.

@maheshmnj maheshmnj added the feedback required Further information is requested label Sep 6, 2021
@AnhTu6610
Copy link
Author

AnhTu6610 commented Sep 8, 2021

Hi @AnhTu6610, Thanks for filing the issue. When filing issues please try to fill some or all of the information requested in the issue template. To investigate the issue further please share the output of flutter doctor -v and add some description and steps to reproduce the issue.
Also make sure you are using the correct ad units id.

flutter doctor -v

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale en-VN)
   • Flutter version 2.2.3 at /Users/mbprolt85/flutter
   • Framework revision f4abaa0735 (10 weeks ago), 2021-07-01 12:46:11 -0700
   • Engine revision 241c87ad80
   • Dart version 2.13.4

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
   • Android SDK at /Users/mbprolt85/Library/Android/sdk
   • Platform android-30, build-tools 30.0.3
   • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
   • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
   ✗ Android license status unknown.
     Run `flutter doctor --android-licenses` to accept the SDK licenses.
     See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
   • Xcode at /Applications/Xcode.app/Contents/Developer
   • Xcode 12.5.1, Build version 12E507
   • CocoaPods version 1.11.0.rc.1

[✓] Chrome - develop for the web
   • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
   • Android Studio at /Applications/Android Studio.app/Contents
   • Flutter plugin can be installed from:
     🔨 https://plugins.jetbrains.com/plugin/9212-flutter
   • Dart plugin can be installed from:
     🔨 https://plugins.jetbrains.com/plugin/6351-dart
   • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.60.0)
   • VS Code at /Applications/Visual Studio Code.app/Contents
   • Flutter extension version 3.26.0

[✓] Connected device (1 available)
   • Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.63

@maheshmnj maheshmnj removed the feedback required Further information is requested label Sep 9, 2021
@maheshmnj
Copy link
Collaborator

maheshmnj commented Sep 9, 2021

@AnhTu6610 Please make sure you are using the correct ad unit ids does the ad load with test unit ids?
Also what version of the ads plugin are you having issues with?
Can you share a minimal reproducible code?

@maheshmnj maheshmnj added the feedback required Further information is requested label Sep 9, 2021
@AnhTu6610
Copy link
Author

i am using test unit ids and google_mobile_ads: ^0.13.4

@maheshmnj
Copy link
Collaborator

maheshmnj commented Sep 9, 2021

Is this issue on Android/ IOS / both? with all types of ads or specific ad?
can you please try running this code sample and also please go through the docs and make sure you satisfy the Prerequisites.

code sample
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';

import 'reusable_inline_example.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  MobileAds.instance.initialize();
  runApp(MyApp());
}

// You can also test with your own ad unit IDs by registering your device as a
// test device. Check the logs for your device's ID value.
const String testDevice = 'YOUR_DEVICE_ID';
const int maxFailedLoadAttempts = 3;

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  static final AdRequest request = AdRequest(
    keywords: <String>['foo', 'bar'],
    contentUrl: 'http://foo.com/bar.html',
    nonPersonalizedAds: true,
  );

  InterstitialAd? _interstitialAd;
  int _numInterstitialLoadAttempts = 0;

  RewardedAd? _rewardedAd;
  int _numRewardedLoadAttempts = 0;

  BannerAd? _anchoredBanner;
  bool _loadingAnchoredBanner = false;

  @override
  void initState() {
    super.initState();
    _createInterstitialAd();
    _createRewardedAd();
  }

  void _createInterstitialAd() {
    InterstitialAd.load(
        adUnitId: InterstitialAd.testAdUnitId,
        request: request,
        adLoadCallback: InterstitialAdLoadCallback(
          onAdLoaded: (InterstitialAd ad) {
            print('$ad loaded');
            _interstitialAd = ad;
            _numInterstitialLoadAttempts = 0;
            _interstitialAd!.setImmersiveMode(true);
          },
          onAdFailedToLoad: (LoadAdError error) {
            print('InterstitialAd failed to load: $error.');
            _numInterstitialLoadAttempts += 1;
            _interstitialAd = null;
            if (_numInterstitialLoadAttempts <= maxFailedLoadAttempts) {
              _createInterstitialAd();
            }
          },
        ));
  }

  void _showInterstitialAd() {
    if (_interstitialAd == null) {
      print('Warning: attempt to show interstitial before loaded.');
      return;
    }
    _interstitialAd!.fullScreenContentCallback = FullScreenContentCallback(
      onAdShowedFullScreenContent: (InterstitialAd ad) =>
          print('ad onAdShowedFullScreenContent.'),
      onAdDismissedFullScreenContent: (InterstitialAd ad) {
        print('$ad onAdDismissedFullScreenContent.');
        ad.dispose();
        _createInterstitialAd();
      },
      onAdFailedToShowFullScreenContent: (InterstitialAd ad, AdError error) {
        print('$ad onAdFailedToShowFullScreenContent: $error');
        ad.dispose();
        _createInterstitialAd();
      },
    );
    _interstitialAd!.show();
    _interstitialAd = null;
  }

  void _createRewardedAd() {
    RewardedAd.load(
        adUnitId: RewardedAd.testAdUnitId,
        request: request,
        rewardedAdLoadCallback: RewardedAdLoadCallback(
          onAdLoaded: (RewardedAd ad) {
            print('$ad loaded.');
            _rewardedAd = ad;
            _numRewardedLoadAttempts = 0;
          },
          onAdFailedToLoad: (LoadAdError error) {
            print('RewardedAd failed to load: $error');
            _rewardedAd = null;
            _numRewardedLoadAttempts += 1;
            if (_numRewardedLoadAttempts <= maxFailedLoadAttempts) {
              _createRewardedAd();
            }
          },
        ));
  }

  void _showRewardedAd() {
    if (_rewardedAd == null) {
      print('Warning: attempt to show rewarded before loaded.');
      return;
    }
    _rewardedAd!.fullScreenContentCallback = FullScreenContentCallback(
      onAdShowedFullScreenContent: (RewardedAd ad) =>
          print('ad onAdShowedFullScreenContent.'),
      onAdDismissedFullScreenContent: (RewardedAd ad) {
        print('$ad onAdDismissedFullScreenContent.');
        ad.dispose();
        _createRewardedAd();
      },
      onAdFailedToShowFullScreenContent: (RewardedAd ad, AdError error) {
        print('$ad onAdFailedToShowFullScreenContent: $error');
        ad.dispose();
        _createRewardedAd();
      },
    );

    _rewardedAd!.setImmersiveMode(true);
    _rewardedAd!.show(onUserEarnedReward: (RewardedAd ad, RewardItem reward) {
      print('$ad with reward $RewardItem(${reward.amount}, ${reward.type}');
    });
    _rewardedAd = null;
  }

  Future<void> _createAnchoredBanner(BuildContext context) async {
    final AnchoredAdaptiveBannerAdSize? size =
        await AdSize.getAnchoredAdaptiveBannerAdSize(
      Orientation.portrait,
      MediaQuery.of(context).size.width.truncate(),
    );

    if (size == null) {
      print('Unable to get height of anchored banner.');
      return;
    }

    final BannerAd banner = BannerAd(
      size: size,
      request: request,
      adUnitId: Platform.isAndroid
          ? 'ca-app-pub-3940256099942544/6300978111'
          : 'ca-app-pub-3940256099942544/2934735716',
      listener: BannerAdListener(
        onAdLoaded: (Ad ad) {
          print('$BannerAd loaded.');
          setState(() {
            _anchoredBanner = ad as BannerAd?;
          });
        },
        onAdFailedToLoad: (Ad ad, LoadAdError error) {
          print('$BannerAd failedToLoad: $error');
          ad.dispose();
        },
        onAdOpened: (Ad ad) => print('$BannerAd onAdOpened.'),
        onAdClosed: (Ad ad) => print('$BannerAd onAdClosed.'),
      ),
    );
    return banner.load();
  }

  @override
  void dispose() {
    super.dispose();
    _interstitialAd?.dispose();
    _rewardedAd?.dispose();
    _anchoredBanner?.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Builder(builder: (BuildContext context) {
        if (!_loadingAnchoredBanner) {
          _loadingAnchoredBanner = true;
          _createAnchoredBanner(context);
        }
        return Scaffold(
          appBar: AppBar(
            title: const Text('AdMob Plugin example app'),
            actions: <Widget>[
              PopupMenuButton<String>(
                onSelected: (String result) {
                  switch (result) {
                    case 'InterstitialAd':
                      _showInterstitialAd();
                      break;
                    case 'RewardedAd':
                      _showRewardedAd();
                      break;
                    default:
                      throw AssertionError('unexpected button: $result');
                  }
                },
                itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
                  PopupMenuItem<String>(
                    value: '$InterstitialAd',
                    child: Text('$InterstitialAd'),
                  ),
                  PopupMenuItem<String>(
                    value: '$RewardedAd',
                    child: Text('$RewardedAd'),
                  ),
                ],
              ),
            ],
          ),
          body: SafeArea(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                if (_anchoredBanner != null)
                  Container(
                    color: Colors.green,
                    width: _anchoredBanner!.size.width.toDouble(),
                    height: _anchoredBanner!.size.height.toDouble(),
                    child: AdWidget(ad: _anchoredBanner!),
                  ),
              ],
            ),
          ),
        );
      }),
    );
  }
}

@AnhTu6610
Copy link
Author

i use ad unit ids it works, but using test unit ids it doesn't work. Only error on ios

@maheshmnj
Copy link
Collaborator

@AnhTu6610, please share a reproducible code sample or a git repo to further investigate the issue. And also which IOS device are you having issues with?

@pynner
Copy link

pynner commented Sep 17, 2021

Having same issue with test ad unit ids

@rocboronat
Copy link

rocboronat commented Oct 7, 2021

Exactly the same here. I have the interstitials working but the banner ones launch this error 😢

In addition, just in case, I added -ObjC to my Other Linker Flags setting. Is it really needed? While this error says `Remember to link...", the readme says nothing about it.

@maheshmnj
Copy link
Collaborator

I can't reproduce the issue the interstitial and banner ads both work fine for me with test Ids.
Labeling this issue as a bug for further investigation.

cc: @jjliu15

@maheshmnj maheshmnj added bug Something isn't working e3-weeks Effort: < 4 weeks p2-medium and removed feedback required Further information is requested in triage Issue currently being evaluated labels Oct 7, 2021
@rocboronat
Copy link

Hello @maheshmnj! In case you need, I could do a call to showcase the issue :)

@maheshmnj
Copy link
Collaborator

maheshmnj commented Oct 7, 2021

@rocboronat, sure please that would be much helpful.

@rocboronat
Copy link

@maheshmnj I'll drop you a line on Twitter 🐦

@maheshmnj
Copy link
Collaborator

maheshmnj commented Oct 7, 2021

In case you need, I could do a call to showcase the issue :)

Ohh, sorry I did not construe it as an actual call, Probably that's not required, you could just share more details here in the thread so that it helps the team members working on this issue.

  • if it occurs on both platforms (Android /IOS)
  • is the issue with only with test ids or real Ids
  • complete logs of flutter run -v (as a text file)
  • Possibly a reproducible code sample (that can be directly run) / steps to reproduce the issue
  • screenshot /videos if required.

Thanks

@rafiqueud
Copy link

Same situation here, any solution?

@rafiqueud
Copy link

rafiqueud commented Oct 7, 2021

Same situation here, any solution?

Using iOS 15 simulator.

Flutter sdk: '>=2.12.0 <3.0.0'
google_mobile_ads: 0.13.5

environment:
  sdk: '>=2.12.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  http: 0.13.3
  share: 2.0.4
  transparent_image: 2.0.0
  url_launcher: 6.0.11
  fluro: 2.0.3
  flutter_launcher_icons: 0.9.2
  cupertino_icons: 1.0.3
  google_mobile_ads: 0.13.5
  firebase_messaging: 10.0.7
  shared_preferences: 2.0.8
  fluttertoast: 8.0.8
  glassmorphism: 3.0.0
  flutter_blurhash: 0.6.0
  sortedmap: 0.5.1
  json_annotation: 4.1.0
  flutter_card_swipper: 0.4.0
  scrollable_positioned_list: 0.2.0-nullsafety.0
  youtube_player_iframe: ^2.2.2
  shimmer: 2.0.0
  cached_network_image: ^3.1.0

@junqi
Copy link

junqi commented Oct 17, 2021

Same situation.
And I noticed that my ad was disabled because I haven't received PIN.
Is this related to this issue? ( I'm going to apply resending PIN )

Below is my Admob home.
image

@erperejildo
Copy link

For me is working on Android but not on iOS

@maheshmnj
Copy link
Collaborator

@AnhTu6610 is this issue resolved?

@andaas4
Copy link

andaas4 commented Dec 10, 2021

I still have this issue with version 1.0.1.

@maheshmnj
Copy link
Collaborator

I think its good to leave this issue open until we are sure that this is fixed.

@maheshmnj maheshmnj reopened this Dec 10, 2021
@manusbreuking
Copy link

I'm getting this error as well.
This is the log running in xcode:
2021-12-14 23:02:36.160970+0100 Runner[61261:8949445] <Google> To get test ads on this device, set: Objective-C GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = @[ kGADSimulatorID ]; Swift GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ kGADSimulatorID ] 2021-12-14 23:02:36.760970+0100 Runner[61261:8950164] [boringssl] boringssl_metrics_log_metric_block_invoke(144) Failed to log metrics 2021-12-14 23:02:36.846160+0100 Runner[61261:8950163] <Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target. 2021-12-14 23:02:36.926166+0100 Runner[61261:8950189] [boringssl] boringssl_metrics_log_metric_block_invoke(144) Failed to log metrics 2021-12-14 23:02:36.928422+0100 Runner[61261:8950189] [boringssl] boringssl_metrics_log_metric_block_invoke(144) Failed to log metrics 2021-12-14 23:02:36.953325+0100 Runner[61261:8950166] <Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target. 2021-12-14 23:02:36.965590+0100 Runner[61261:8949756] flutter: Ad failed to load: ca-app-pub-3940256099942544/2934735716, LoadAdError(code: 8, domain: com.google.admob, message: Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target., responseInfo: ResponseInfo(responseId: fBS5YaT5O4mrtwfqk7GYDQ, mediationAdapterClassName: null, adapterResponses: [AdapterResponseInfo(adapterClassName: com.google.DummyAdapter, latencyMillis: 1), description: { Credentials = { }; Error = "Error Domain=com.google.admob Code=8 \"Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.\" UserInfo={NSLocalizedDescription=Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.}"; Latency = "0.001"; Network = "com.google.DummyAdapter"; }, credentials: { }, adError: AdError(code: 8, domain: com.google.admob, message: Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.))])).

No Ads are shown.

If I change the Bundle Identifier in xcode (ie: by adding a 1 at the end) and run the project ads are shown.
Unfortunately this will not work for me since changing the bundle identifier is a no go for me.

@lsamaria
Copy link

lsamaria commented Dec 19, 2021

pod 'Google-Mobile-Ads-SDK'
FirebaseAnalytics/AdIdSupport (8.9.1)
Firebase (8.9.1):

Xcode -Version 12.4 (12D4e)
iPad Simulator -12.9 inch 3rd Generation

I'm having this issue with banner ad testAdID units when rotating on an iPad to landscape.
For example in Portrait the test ad shows and works fine but once I rotate the iPad to landscape I get

Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.

The odd thing is once I rotate back to portrait the ad appears.

This process is non-stop. The ad always shows in portrait but nothing shows in landscape with the same above error message

I looked in Target > Build Settings > All > Other Linker Flags and it was already set to Obj-C

Screen Shot 2021-12-19 at 6 43 28 AM

code:

// called in ViewDidLoad
func initializeAdMob() {
    
    let adMobKey = "ca-app-pub-3940256099942544/2934735716"
    
    bannerView.adUnitID = adMobKey
    bannerView.rootViewController = self
    bannerView.delegate = self
    
    let adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(frame.size.width)
    bannerView.adSize = adSize
    
    view.addSubview(bannerView)
    bannerView.heightAnchor.constraint(equalToConstant: 50).isActive = true
    bannerView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
    bannerView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
    bannerView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -15).isActive = true

    bannerView.load(GADRequest())
}

@lsamaria
Copy link

Answer to my issue is here. I just had to use my real ad unit id for it work

@erperejildo
Copy link

erperejildo commented Dec 22, 2021

Answer to my issue is here. I just had to use my real ad unit id for it work

I was using the real ad unit all the time and also getting this issue on published app

[✓] Flutter (Channel stable, 2.8.1, on macOS 11.6.1 20G224 darwin-x64, locale en-GB)
    • Flutter version 2.8.1 at /Users/dani/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (6 days ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/dani/Library/Android/sdk
    • Platform android-Sv2, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.62.0)
    • VS Code at /Users/dani/Desktop/Visual Studio Code.app/Contents
    • Flutter extension version 3.28.0

[✓] Connected device (2 available)
    • iPhone 11 (mobile) • 6CF40450-67B5-4597-9CAB-7F0A33CB8453 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 96.0.4664.110

• No issues found!

This issue was created almost 4 months ago. Any solution so far? This is showing no ads for me on iOS

@gitpushforce
Copy link

gitpushforce commented Dec 30, 2021

I had the same problem. I found this thread while googling a solution.
I got it working now. I hope this helps you out.
In my case im using xcode, swift. Im sorry, i dont use flutter but maybe some of you might have an idea how to apply my solution to flutter.

Basically the information of the site below helped a lot.
https://developers.google.com/admob/ios/test-ads#enable_test_devices

you have 2 options.

  1. If you are using app-ads.txt of admob then you have to add this line the file.
    google.com, pub-3940256099942544, DIRECT, f08c47fec0942fa0
    Then you will get the test ads working as soon as admob confirm your new app-ads.txt.

  2. add your device as a test device in admob (i think you already did it).
    Then check the error logs and find this part

<Google> To get test ads on this device, set: 
Objective-C
	GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = @[ @"ca45365ebb00dc64001d5c16f7db427eb" ];
Swift
	GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ @"ca45365ebb00dc64001d5c16f7db427eb" ]

Im using swift, so i added Swift part to AppDelegate as below (be sure that the serial number that you got in the log is set as testDeviceIdentifier and not the number im writing in this example )

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ "ca45365ebb00dc64001d5c16f7db427eb" ]
        return true
    }

Finally, be sure you have all the ad networks are set (Info.plist in my case). This document tells you how to do it
https://developers.google.com/admob/ios/quick-start

@huycozy
Copy link
Collaborator

huycozy commented Jul 19, 2023

We’re closing this issue due to inactivity. If you’re still impacted, please create a new issue via the Developer Forum.

@huycozy huycozy closed this as not planned Won't fix, can't repro, duplicate, stale Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working e3-weeks Effort: < 4 weeks p2-medium
Projects
None yet
Development

No branches or pull requests