Error: SDK tried to perform a networking task before being initialized
[REQUIRED] Step 1: Describe your environment
- Unity version: 2021.3.3f1
- Google Mobile Ads Unity plugin version: 7.0.1
- Platform: iOS
- Platform OS version: iOS 15+
- Any specific devices issue occurs on: _____
- Mediation ad networks used, and their versions: BidstackCustomAdapterAdMob 1.2.3 (includes custom events)
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
What happened? How can we make the problem occur? This could be a description, log/console output, etc.
BidstackCustomAdapterAdMob is a custom framework for interstitial and rewarded video ads that uses GADMediationAdapter. Tested framework on native iOS app and it works without any errors.
When I added framework into Unity project through Dependencies.xml and build it to Xcode, got the error SDK tried to perform a networking task before being initialized when tried to load Interstitial or Rewarded video ads. All of the ads are called after 'MobileAds.Initialize' callback.
I tried adding only AdMob GoogleMobileAdsSDK to my Unity project, got test ads, everything worked. Then tried to add my framework - got the error.
Found that adding UnityFramework.framework to Xcode Build Phases -> Link Binary With Libraries fixes my problem and I got the right ads from custom event.
But this is not the solution I'm looking for as for users all of the setting should be set in Unity, not Xcode, because some are building to the cloud.
Logs: Adapter: BidstackInterstitialEvent is initialized. AdMobManager:<Start>b__10_0(InitializationStatus)
Adapter: BidstackRewardedEvent is initialized. AdMobManager:<Start>b__10_0(InitializationStatus)
Adapter: GADMobileAds is initialized. AdMobManager:<Start>b__10_0(InitializationStatus)
MobileAds.Initialize initStatus: GoogleMobileAds.Api.InitializationStatus AdMobManager:<Start>b__10_0(InitializationStatus)
event received with message: Error Domain=com.google.admob Code=2 "SDK tried to perform a networking task before being initialized." UserInfo={NSLocalizedDescription=SDK tried to perform a networking task before being initialized., gad_response_info= ** Response Info ** Response ID: (null) Network: (null) ** Mediation line items ** }
Also, I added AdInspector to my Unity project. When I open it, it looks like this:
As you see, AdInspector shows that Adapter is initialized.
@LieneUngure
Do you have a minimal sample ap which replicates this issue? Preferably with Bidstack source code? I looked around and could not find one.
https://github.com/bidstack-group/bidstack-custom-adapter-admob-android
@NVentimiglia Hi! Thank You for Your reply!
The problem is with iOS, not with Android.
I attached a Unity sample app project to this email. Unfortunately, I can't send You our adapter source code.
A little bit more about BidstackCustomAdapterAdMob framework:
- written in Obj-C
- Has two dependencies - AdMob and BidstackMobileAdsSDK
- Consists of custom event implementation for Interstitial and Rewarded ads (like described in your documentation here: https://developers.google.com/admob/ios/custom-events/rewarded)
This framework is added to cocoapods and works if used in native iOS projects (added through pods). The problem is when I add it to the Unity project and build it to Xcode. Bidstack AdMob Adapter Test App.zip https://drive.google.com/file/d/1u1AV6SaYteEUrqMlJa5lMoX-sqMgp0io/view?usp=drive_web
otrd., 2022. g. 24. maijs, plkst. 18:36 — lietotājs Nicholas Ventimiglia (< @.***>) rakstīja:
@LieneUngure https://github.com/LieneUngure
Do you have a minimal sample ap which replicates this issue? Preferably with Bidstack source code? I looked around and could not find one.
https://github.com/bidstack-group/bidstack-custom-adapter-admob-android
— Reply to this email directly, view it on GitHub https://github.com/googleads/googleads-mobile-unity/issues/2059#issuecomment-1136084740, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIOKC6LRM7UDSI2MF4C7TJLVLTZPNANCNFSM5WYUGC5Q . You are receiving this because you were mentioned.Message ID: @.***>
@NVentimiglia
Did you had a chance to look at this issue?
Hi @LieneUngure
I would really like to help, but I am not sure what next steps are. The issue is internal to a closed source module. It sounds like a order of operation concern regarding initialization. Please make sure that MobileAds.Initialize() is called before initialization anything else and make sure the application Id is present in the plist.info.
@NVentimiglia
The error happens only when I use Unity and build project to Xcode. I attached sample app in my previous reply. The weirdest thing is that error disappears when I add UnityFramework.framework to Build Phases->Link Binary With Libraries. But unfortunately, this is not a "solution" I'm looking for.
You can download the sample app, build it and run in Xcode and see for yourself.
@NVentimiglia
The error happens only when I use Unity and build project to Xcode. I attached sample app in my previous reply. The weirdest thing is that error disappears when I add UnityFramework.framework to Build Phases->Link Binary With Libraries. But unfortunately, this is not a "solution" I'm looking for.
You can download the sample app, build it and run in Xcode and see for yourself.
Did you manage to find a solution?
Since there were no recent activities for this issue, we are therefore reluctantly going to close this bug for now.
If you are still experiencing the problem, please file a new issue with the same description, what happens and system / network tracing / Charles logs.
All system setups can be slightly different, so it's always better to open new issues and reference the related ones. Thanks for your contribution.