googleads / googleads-mobile-flutter

A Flutter plugin for the Google Mobile Ads SDK
Apache License 2.0
339 stars 279 forks source link

Multiple errors in production app #644

Closed Tom3652 closed 1 year ago

Tom3652 commented 2 years ago

Plugin Version

google_mobile_ads: ^2.0.1

Steps to Reproduce

My live app reports some errors logs from crashlytics so i have no way to reproduce them locally everything works fine in debug but not in release.

I am sorry for how this issue looks like, it's just very long to make an issue for all of them as they are all not reproductible in debug mode in my case.

Expected results:

Not seeing so many errors in my crashlytics dashboard.

Actual results:

Here is a preview of all the errors i am getting.

Capture d’écran 2022-09-10 à 20 04 58

I will go in details in the Logs section. Note : for all the below logs, i have put the occurrence for each platform, of course the logs are slightly different from iOS and Android but they are close enough for me to gather them.

Besides i don't know why some of the iOS errors are written in French while Android is all in English.

Logs ### Networking Android : 77 times iOS : 36 times ``` Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Vwa(code: 2, domain: com.google.android.gms.ads, message: Network error., responseInfo: Twa(responseId: null, mediationAdapterClassName: , adapterResponses: [])). Error thrown Reason : Network error. and code : 2. ``` Android : 66 times iOS : 0 times ``` Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Vwa(code: 0, domain: com.google.android.gms.ads, message: Error while connecting to ad server: Unable to resolve host "googleads.g.doubleclick.net": No address associated with hostname, responseInfo: Twa(responseId: null, mediationAdapterClassName: , adapterResponses: [])). Error thrown Reason : Error while connecting to ad server: Unable to resolve host "googleads.g.doubleclick.net": No address associated with hostname and code : 0. ``` Android : 3 times iOS : 0 times ``` Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Vwa(code: 0, domain: com.google.android.gms.ads, message: Error while connecting to ad server: unexpected end of stream on com.android.okhttp.Address@acefc12c, responseInfo: Twa(responseId: null, mediationAdapterClassName: , adapterResponses: [])). Error thrown Reason : Error while connecting to ad server: unexpected end of stream on com.android.okhttp.Address@acefc12c and code : 0. ``` Android : 3 times iOS : 6 times ``` Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Vwa(code: 0, domain: com.google.android.gms.ads, message: Error while connecting to ad server: Read error: ssl=0x7370df7208: Failure in SSL library, usually a protocol error error:100000d7:SSL routines:OPENSSL_internal:SSL_HANDSHAKE_FAILURE (third_party/openssl/boringssl/src/ssl/ssl_lib.cc:971 0x753bff341c:0x00000000), responseInfo: Twa(responseId: null, mediationAdapterClassName: , adapterResponses: [])). Error thrown Reason : Error while connecting to ad server: Read error: ssl=0x7370df7208: Failure in SSL library, usually a protocol error error:100000d7:SSL routines:OPENSSL_internal:SSL_HANDSHAKE_FAILURE (third_party/openssl/boringssl/src/ssl/ssl_lib.cc:971 0x753bff341c:0x00000000) and code : 0. ``` ### Code Android : 127 times iOS : 0 times ``` Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Vwa(code: 0, domain: com.google.android.gms.ads, message: Unable to obtain a JavascriptEngine., responseInfo: Twa(responseId: null, mediationAdapterClassName: , adapterResponses: [])). Error thrown Reason : Unable to obtain a JavascriptEngine. and code : 0. ``` Android : 54 times iOS : 0 times ``` Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Vwa(code: 3, domain: com.google.android.gms.ads, message: No ad config., responseInfo: Twa(responseId: null, mediationAdapterClassName: , adapterResponses: [])). Error thrown Reason : No ad config. and code : 3. ``` Android : 0 times iOS : 37 times ``` LoadAdError(code: 9, domain: com.google.admob, message: Request Error: No ad to show from all configured ad networks., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: null, adapterResponses: [])) ``` Android : 6 times iOS : 0 times ``` Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Vwa(code: 0, domain: com.google.android.gms.ads, message: Internal error., responseInfo: Twa(responseId: CIu4hpzg-_kCFYSEhQod3IEIFQ, mediationAdapterClassName: , adapterResponses: [Uwa(adapterClassName: com.google.ads.mediation.admob.AdMobAdapter, latencyMillis: 60001), description: { "Adapter": "com.google.ads.mediation.admob.AdMobAdapter", "Latency": 60001, "Credentials": {}, "Ad Error": { "Code": 0, "Message": "Internal error.", "Domain": "com.google.android.gms.ads", "Cause": "null" } }, adUnitMapping: {}, adError: Swa(code: 0, domain: com.google.android.gms.ads, message: Internal error.))])). Error thrown Reason : Internal error. and code : 0. ``` ### Flutter doctor ``` [✓] Flutter (Channel stable, 3.3.1, on macOS 12.5.1 21G83 darwin-x64, locale fr-FR) • Flutter version 3.3.1 on channel stable at /Users/foxtom/Desktop/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 4f9d92fbbd (4 days ago), 2022-09-06 17:54:53 -0700 • Engine revision 3efdf03e73 • Dart version 2.18.0 • DevTools version 2.15.0 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/foxtom/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 13F100 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.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.12+0-b1504.28-7817840) [✓] VS Code (version 1.71.0) • VS Code at /Users/foxtom/Desktop/Visual Studio Code.app/Contents • Flutter extension version 3.46.0 [✓] Connected device (4 available) • moto g 8 power (mobile) • 172.16.1.195:5555 • android-arm64 • Android 11 (API 30) • Now You See Me (mobile) • 00008020-001204401E78002E • ios • iOS 15.6.1 19G82 • macOS (desktop) • macos • darwin-x64 • macOS 12.5.1 21G83 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.102 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```
huycozy commented 2 years ago

Hi @Tom3652, thanks for filing the issue. Does the issue happen when you run the app with release mode? You may try releasing a new APK file and then installing it on your device to see if the issue is reproducible.

Tom3652 commented 2 years ago

Hi @huycozy, i have tried in release and profile mode but i can't reproduce it... Besides i should not be using real ads while testing locally, so usually i use the test ads and i can't reproduce it anyway. I have tried by turning off and on my wifi / mobile data but it didn't change anything.

I tested on OPPO Android 10, but these issues are spreading across very different kind of device so i don't think it's device specific.

EDIT : at the moment i send this comment i see these error in debug mode in airplane mode :

I/Ads     ( 6347): Ad failed to load : 2
I/flutter ( 6347): Ad failed to load: LoadAdError(code: 2, domain: com.google.android.gms.ads, message: Network error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
I/flutter ( 6347): ----------------FIREBASE CRASHLYTICS----------------
I/flutter ( 6347): The following exception was thrown Reason : Network error. and code : 2:
I/flutter ( 6347): LoadAdError(code: 2, domain: com.google.android.gms.ads, message: Network error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
I/flutter ( 6347): 
I/flutter ( 6347): ----------------------------------------------------
I/flutter ( 6347): Ad failed to load: LoadAdError(code: 2, domain: com.google.android.gms.ads, message: Network error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
I/flutter ( 6347): ----------------FIREBASE CRASHLYTICS----------------
I/flutter ( 6347): The following exception was thrown Reason : Network error. and code : 2:
I/flutter ( 6347): LoadAdError(code: 2, domain: com.google.android.gms.ads, message: Network error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
I/flutter ( 6347): 
I/flutter ( 6347): ----------------------------------------------------
I/flutter ( 6347): Ad failed to load: LoadAdError(code: 2, domain: com.google.android.gms.ads, message: Network error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
I/flutter ( 6347): ----------------FIREBASE CRASHLYTICS----------------
I/flutter ( 6347): The following exception was thrown Reason : Network error. and code : 2:
I/flutter ( 6347): LoadAdError(code: 2, domain: com.google.android.gms.ads, message: Network error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
I/flutter ( 6347): 
I/flutter ( 6347): ----------------------------------------------------
I/flutter ( 6347): Ad failed to load: LoadAdError(code: 2, domain: com.google.android.gms.ads, message: Network error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
I/flutter ( 6347): ----------------FIREBASE CRASHLYTICS----------------
I/flutter ( 6347): The following exception was thrown Reason : Network error. and code : 2:
I/flutter ( 6347): LoadAdError(code: 2, domain: com.google.android.gms.ads, message: Network error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
I/flutter ( 6347): 
I/flutter ( 6347): ----------------------------------------------------

So yes the networking part is reproductible easily even in debug mode.

huycozy commented 2 years ago

Hi @Tom3652, thanks for responding and having a deep investigation.

I/flutter (31107): BannerAd failedToLoad: LoadAdError(code: 0, domain: com.google.android.gms.ads, message: Internal error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
I/flutter (31107): NativeAd failedToLoad: LoadAdError(code: 0, domain: com.google.android.gms.ads, message: Internal error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
I/flutter (31107): AdManagerBannerAd failedToLoad: LoadAdError(code: 0, domain: com.google.android.gms.ads, message: Internal error., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))

If you can find out anything else, please provide it, it will be helpful for investigation. Thank you a lot!

Tom3652 commented 2 years ago

Thanks for the digging @huycozy !

I will be following especially No ad config since it's happening frequently !

For the unable to obtain a JavascriptEngine, i am really not sure to understand what is suggested in the comment. Do you know how to whitelist AdMob URLs from my flutter app ?

I am not using a specific DNS or something as mentioned either as it's simply users around the world using my live app :/ but maybe they are on a wifi that is actually blocking requests somehow...

huycozy commented 2 years ago

Do you know how to whitelist AdMob URLs from my flutter app ?

@Tom3652 I'm also not sure about this. I guess he used pi-hole DNS while testing the project locally (not from an end-user device) @sezaru Could you please share what you have completed as confirmed in https://github.com/googleads/googleads-mobile-flutter/issues/149#issuecomment-814525003?

I am not using a specific DNS or something as mentioned either as it's simply users around the world using my live app :/ but maybe they are on a wifi that is actually blocking requests somehow...

Maybe the end-user used a DNS similar to @sezaru's or VPN as reported in https://github.com/googleads/googleads-mobile-flutter/issues/527#issuecomment-1064925394 that causes the ad to be blocked. You can follow up on #527 for further updates.

github-actions[bot] commented 1 year ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. 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.