admob_flutter icon indicating copy to clipboard operation
admob_flutter copied to clipboard

Cannot find an ad network adapter with the name com.google.DumyAdapter error

Open serendipity1004 opened this issue 6 years ago • 14 comments

I am currently using banner ad to be displayed in listview.separated widget. I am displaying banner ad in separators every few indexes. The widget I use is like below.

return AdmobBanner(
                  adUnitId: 'ca-app-pub-3940256099942544/2934735716',
                  adSize: AdmobBannerSize.MEDIUM_RECTANGLE,
                  listener: (AdmobAdEvent event, Map<String, dynamic> args) {
                    switch (event) {
                      case AdmobAdEvent.loaded:
                        print('Admob banner loaded!');
                        break;

                      case AdmobAdEvent.opened:
                        print('Admob banner opened!');
                        break;

                      case AdmobAdEvent.closed:
                        print('Admob banner closed!');
                        break;

                      case AdmobAdEvent.failedToLoad:
                        print(
                            'Admob banner failed to load. Error code: ${args['errorCode']}');
                        break;

                      default :
                        print('other events');
                    }
                  }
              );

I am using the test adUnitId provided from https://developers.google.com/admob/ios/test-ads?hl=ko

The problem is that ad tries to load multiple times and causes error like below

<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: Admob banner failed to load. Error code: 8
<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: Admob banner failed to load. Error code: 8
<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.
<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.
<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.

How do I overcome this error? I am using my own admob app id in the info.plist

flutter doctor

All done!
[✓] Flutter is fully installed. (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.5 18F132, locale en-KR)
[✓] Android toolchain - develop for Android devices is fully installed. (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS is fully installed. (Xcode 10.3)
[✓] iOS tools - develop for iOS devices is fully installed.
[✓] Android Studio is fully installed. (version 3.3)
[✓] IntelliJ IDEA Ultimate Edition is fully installed. (version 2018.3.5)
[✓] Connected device is fully installed. (1 available)

serendipity1004 avatar Aug 29 '19 05:08 serendipity1004

Encountered the same problem, log print :'handleEvent---->>>AdmobAdEvent.loaded', but no ad image display. ios 12.04, admob_flutter: ^0.3.1

telinx avatar Aug 29 '19 12:08 telinx

Same issue for IOS only...

Mellie45 avatar Sep 06 '19 14:09 Mellie45

i have the same issue for IOS too ... any solution???

DjaberDribine avatar Sep 08 '19 21:09 DjaberDribine

Hi Youssef,I'm away from my desk for a couple of weeks but I'm wondering if the solution lays in the as unit URLs. I'm thinking that the unit needs to be generated on admob for both Android and iOS and then loaded via a conditional within the widget tree... I'll give it a go when I get back but you may have time... If so do let me know how you get on. It's frustrating as it's such a great solution.Good luckMelOn 8 Sep 2019 10:07 pm, DjaberDribine [email protected] wrote:i have the same issue for IOS too ... any solution???

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

Mellie45 avatar Sep 08 '19 21:09 Mellie45

@serendipity1004 - @Mellie45 - @DjaberDribine You must use the ad unit id's for android and ios separately, for each use case. I do something like this.

  static String getInterstitialId() {
    if(Application.isDebugMode) {
      return Platform.isAndroid ? 'ca-app-pub-androidtestid' : 'ca-app-pub-iostestid';
    }
    return Platform.isAndroid ? 'ca-app-pub-prodandroidid' : 'ca-app-pub-prodiosid';
  }

Hope this help's ya'll. Let me know and I can close this issue. Thanks!

kmcgill88 avatar Sep 11 '19 18:09 kmcgill88

@serendipity1004 - @Mellie45 - @DjaberDribine

To further clarify. AFAIK, you also have to init the plugin per platform. I register 2 apps in admob, 1 Android and 1 iOS. Both apps get their own unique app id.

In Flutter, main.dart I do

// NOTE: Different app id's per platform!
final String appId = Platform.isAndroid
      ? ANDROID_APP_ID
      : IOS_APP_ID;

void main() async {
  Admob.initialize(appId);
 //...other init code
}

Then I use helpers functions per ad unit to get the correct ad unit id, per platform. Again:

  static String getBannerId() {
    if(Application.isDebugMode) {
      // use test ad unit id's
     // iOS: https://developers.google.com/admob/ios/test-ads
     // Android: https://developers.google.com/admob/android/test-ads
    // NOTE: The test ad unit id's are DIFFERENT per platform 
      return Platform.isAndroid ? 'ca-app-pub-androidtestid' : 'ca-app-pub-iostestid';
    }
    
    // Your prod ad units will/should be different per platform as well!
    return Platform.isAndroid ? 'ca-app-pub-prodandroidid' : 'ca-app-pub-prodiosid';
  }

If one of you can confirm this fixes the issue I will add this to an FAQ. This seems to confuse many people. It happened to me too when I started implementing the iOS side of things.

kmcgill88 avatar Sep 12 '19 16:09 kmcgill88

@kmcgill88 no that is not the problem. I am using the IDs provided in the example of this project but still same error.

serendipity1004 avatar Sep 17 '19 01:09 serendipity1004

@kmcgill88 I can confirm for you though that the official firebase_admob plugin works correctly. So either I am missing something or there's a difficult to find bug.

serendipity1004 avatar Sep 17 '19 01:09 serendipity1004

I'm facing same issue in iOS only.
I using the test id. and android is normal.

ezero9 avatar Sep 22 '19 11:09 ezero9

@kmcgill88 I've tested again with the following code adjustments. 1st I simply changed my helper functions to follow precisely your patterns. This I tried to run with both the supplied test ID's for the appID and test unit Ids, and also with id's generated via my adMob account. Next I converted the helper functions back to the pattern from the install documentation and again tried to run with both id options as above. Next I ran the above options with the test app identifier as the key in the info.plist and also with my unique app key. Still no success for IOS. The best result I can achieve is to have the screen fail to load any network data rather than simply crashing, even with the main function where AdMob is initialised changed to be async... So I'm guessing this has something to do with network calls as the problem seems to occur within the IOS version of my app that is linked to a Firebase Database.

Mellie45 avatar Sep 24 '19 08:09 Mellie45

same!

virskor avatar Oct 20 '19 05:10 virskor

I had the same issue and I fixed it adding:

<key>io.flutter.embedded_views_preview</key>
<true/>

In the info.plist. Neither the test ads nor the normal ads where working without this on Flutter 1.17.0. Everything is fine now.

js2702 avatar May 07 '20 18:05 js2702

I had the same issue and I fixed it adding:

<key>io.flutter.embedded_views_preview</key>
<true/>

In the info.plist. Neither the test ads nor the normal ads where working without this on Flutter 1.17.0. Everything is fine now.

Thank you, that fixed the issue for me.

christian223 avatar Jun 05 '20 10:06 christian223

More info. on this: I already had required arguments in info.plist but still there was an error. What I was doing: using a Visibility widget as a parent and changed the visibility depending whether the ad was loaded or not, means the initial flag for visibility was set false. But when I changed the initial value to true, the error was gone...

ItzNotABug avatar Jun 10 '20 08:06 ItzNotABug