SDK tried to perform a networking task before being initialized

954 views
Skip to first unread message

Jakob Højgård

unread,
Dec 7, 2021, 9:26:53 AM12/7/21
to Google Mobile Ads SDK Developers
Hi

I followed the guide and is running: GADMobileAds.sharedInstance().start()
From Appdelegate.

Then in my viewController im setting in a bannerView:
 let adSize = GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(self.view.frame.width)

        let bannerView = GADBannerView(adSize: adSize)

        bannerView.adUnitID = "ca-app-pub-3940256099942544/2934735716"

        bannerView.rootViewController = rootViewController

        let request = GADRequest()

        bannerView.load(request)

        bannerView.delegate = self

        return bannerView

But I get this in the didFailToReceiveAdWithError delegate function:
bannerView:didFailToReceiveAdWithError: SDK tried to perform a networking task before being initialized.

If I observe the status after the Start() I see that Adapter Name: GADMobileAds, Description: <GADAdapterStatus: 0x6000033cdf50; state = Ready>

And Im trying to run on the test account. 

Im using the latest SDK via Cocoapods. 

I hope you have some suggestions as to what to try to get the test ads up and running?

Jakob Højgård

unread,
Dec 8, 2021, 9:21:37 AM12/8/21
to Google Mobile Ads SDK Developers
This is the printed error I get:

Received error with domain: com.google.admob, code: 2,message: SDK tried to perform a networking task before being initialized., responseInfo:   ** Response Info **

    Response ID: (null)

    Network: (null)

  ** Mediation line items **

,underLyingError: nil

Mobile Ads SDK Forum Advisor

unread,
Dec 8, 2021, 11:54:31 PM12/8/21
to app...@uidesign.dk, google-adm...@googlegroups.com
Hi Jakob,

Thank you for raising this to us.

Could you kindly try to add use_frameworks! :linkage => :static on your pod file, then let me know if the error still persists?

Regards,
Google Logo
Teejay Wennie Pimentel
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2ScmXs:ref

Jakob Højgård

unread,
Dec 9, 2021, 3:09:08 AM12/9/21
to Google Mobile Ads SDK Developers
Hi

I tried the suggested modification to the Pod file,  but it makes no difference. I have these observations maby thats can give you some hints?

I get this message in the consol when launching the app:

AdMob App ID changed. Original, new: (nil), ca-app-pub-3940256099942544~.....

I have printet out the adapterStatusesByClassName when running GADMobileAds.sharedInstance().start:
["SampleCustomEventRewarded": <GADAdapterStatus: 0x6000011e4c30; state = Not Ready;No such adapter in the application.>,
"SampleCustomEventNativeAd": <GADAdapterStatus: 0x60000117adc0; state = Not Ready;No such adapter in the application.>,
"GADMediationAdapterVungle": <GADAdapterStatus: 0x60000114d770; state = Not Ready;No such adapter in the application.>,
"GADMediationAdapterInMobi": <GADAdapterStatus: 0x6000011ec7b0; state = Not Ready;No such adapter in the application.>,
"GADMediationAdapterTapjoy": <GADAdapterStatus: 0x600001170c30; state = Not Ready;No such adapter in the application.>,
"SampleCustomEventBanner": <GADAdapterStatus: 0x6000011b0480; state = Not Ready;No such adapter in the application.>,
"MediationExample.SampleCustomEventInterstitialSwift": <GADAdapterStatus: 0x6000011b08a0; state = Not Ready;No such adapter in the application.>,
"GADMediationAdapterSample": <GADAdapterStatus: 0x60000114ca80; state = Not Ready;No such adapter in the application.>,
"GADMobileAds": <GADAdapterStatus: 0x60000117ad00; state = Ready>,
"MediationExample.SampleCustomEventNativeAdSwift": <GADAdapterStatus: 0x600001171440; state = Not Ready;No such adapter in the application.>,
"GADMediationAdapterAdColony": <GADAdapterStatus: 0x60000113bc00; state = Not Ready;No such adapter in the application.>,
"GADMediationAdapterAppLovin": <GADAdapterStatus: 0x600001146850; state = Not Ready;No such adapter in the application.>,
"SampleCustomEventRewardedBasedVideoSwift": <GADAdapterStatus: 0x600001139c50; state = Not Ready;No such adapter in the application.>,
"SampleCustomEventInterstitial": <GADAdapterStatus: 0x600001152a00; state = Not Ready;No such adapter in the application.>,
"MediationExample.SampleCustomEventBannerSwift": <GADAdapterStatus: 0x6000011ec900; state = Not Ready;No such adapter in the application.>]

When requseting a test banner:

        bannerView = GAMBannerView(adSize: GADAdSizeMediumRectangle)

        bannerView.adUnitID = forAdId

        bannerView.delegate = self

        bannerView.rootViewController = rootViewController

        let req = GAMRequest()

        bannerView.load(req) 

I get this error no matter what ApplicationIdentifier and test unitId I try :

Received error with domain: com.google.admob, code: 2,message: SDK tried to perform a networking task before being initialized., responseInfo:   ** Response Info **
    Response ID: (null)
    Network: (null)
  ** Mediation line items **
,underLyingError: nil

Jakob Højgård

unread,
Dec 9, 2021, 3:16:18 AM12/9/21
to Google Mobile Ads SDK Developers
This is my Pod file: (could it be that theres some conflicts between the other sdks?)

# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks! :linkage => :static

def iosApp_pods
  pod 'AppCenter'
  pod 'MaterialComponents/Tabs+TabBarView'
  pod 'Kingfisher', '~> 6.2.1'
  pod 'JTAppleCalendar', '~> 8.0.3'
  pod 'ReactiveKit'
  pod 'Bond'
 
  # Analytics
  pod 'ACPAnalytics', '~> 2.0'
  pod 'ACPCore', '~> 2.0'
  pod 'ACPUserProfile', '~> 2.0'
 
  # Pushologies
  pod 'Pushologies', '~> 2.2'
 
  # AppsFlyer
  pod 'AppsFlyerFramework'
 
  pod 'ScrollStackController'
 
  pod 'Google-Mobile-Ads-SDK'
end

Mobile Ads SDK Forum Advisor

unread,
Dec 9, 2021, 4:37:06 AM12/9/21
to app...@uidesign.dk, google-adm...@googlegroups.com

Hi Jakob,

Thank you for your response.

Have you tried to remove this "~>" in your pod file? Also, have you tried connecting to another internet connection while trying to run your app? Could you please provide the following details via Reply privately to author option or send it directly to mobileads...@gmail.com? Kindly inform us on this thread if you sent it directly to the email provided.

  • Sample app project implementation
  • Steps to replicate
  • SDK version

Regards,

Google Logo
Princess Pamela Pineda
Mobile Ads SDK Team
 

 

ref:_00D1U1174p._5004Q2ScmXs:ref

Jakob Højgård

unread,
Dec 10, 2021, 9:08:56 AM12/10/21
to Google Mobile Ads SDK Developers
I found the cause. It was in the pod file. While our project as multiple targets the root set of pods where just copied into all targets, leading to a case where the GoogleMobileAds SDK where embedded multiple times. leading to a situation where the SDK would be initialized in one taget but not the other...

So the solution was to only embed the Google Ads SDK in one target, in our case the main or root target.

Mobile Ads SDK Forum Advisor

unread,
Dec 12, 2021, 9:11:22 PM12/12/21
to app...@uidesign.dk, google-adm...@googlegroups.com

Hi Jakob,

Thank you for your response.

I'm glad to know that you are now able to determine the cause of the error and now able to fix it. If you have any other concerns for Google Mobile Ads SDK, just let us know.

Rupendra Aajtak

unread,
Jan 29, 2024, 5:55:46 AM1/29/24
to Google Mobile Ads SDK Developers
Hello Team, 
Did you found any solution for the problem. I have same issue. 

I have created one SDK which have admob integrated. and The application which we used this SDK have also google ads itself. Now when application launch it call failed response with error message SDK tried to perform a networking task before being initialized.


Can  you guy help me for this. 

Mobile Ads SDK Forum Advisor

unread,
Jan 29, 2024, 10:00:16 PM1/29/24
to rupendra...@gmail.com, google-adm...@googlegroups.com

Hi Rupendra,

Thank you for contacting the Mobile Ads SDK support team.

By reviewing your concern, I understand that one of your apps is facing an error “SDK tried to perform a networking task before being initialized”.

Kindly provide the below information for further investigation privately:

  • app ID
  • ad unit ID
  • Mobile Ads SDK Version being used

You can provide the following details via reply privately to the author option or directly provide it to the link below

This message is in relation to case "ref:!00D1U01174p.!5004Q02ScmXs:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team


Reply all
Reply to author
Forward
0 new messages