ANR rate still increasing despite updating to latest AdMobSDK

1,537 views
Skip to first unread message

Marcin Małysz

unread,
Jun 12, 2023, 7:40:59 AM6/12/23
to Google Mobile Ads SDK Developers
Hi 

I'm trying to find the reason of ANRs in our app as the threshold is very high 

We are using newest LTS Unity Version 2021.3.25f1
We have also integrated newest AdMobSDK 8.3.0
To make sure there are no other partner networks problem we have removed all mediation from our current build (so clean AdMobSDK only)

Also we incorporated all required flags like:
 <meta-data android:name="com.google.android.gms.ads.flag.OPTIMIZE_INITIALIZATION" android:value="true"/>
    <meta-data android:name="com.google.android.gms.ads.flag.OPTIMIZE_AD_LOADING" android:value="true"/>


Yet we still see same repeating ANR 

aga.ba (:com.google.android.gms.policy_ads_fdr_dynamite@231710101@231710100057.526733554.526733554:2)

Please assist what can we can do to minimize ANR on Admob setup.

Full callstack:

            com.unity3d.player.ReflectionHelper.nativeProxyInvoke (Native method)
com.unity3d.player.ReflectionHelper.a (unavailable)
com.unity3d.player.ReflectionHelper$1.invoke (unavailable:29)
java.lang.reflect.Proxy.invoke (Proxy.java:1006)
com.google.android.gms.ads.initialization.OnInitializationCompleteListener.onInitializationComplete (com.google.android.gms:play-services-ads-lite@@22.1.0)
com.google.android.gms.ads.internal.client.zzei.zzb (com.google.android.gms:play-services-ads-lite@@22.1.0:8)
com.google.android.gms.internal.ads.zzbkf.zzbE (com.google.android.gms:play-services-ads-lite@@22.1.0:3)
com.google.android.gms.internal.ads.zzatk.onTransact (com.google.android.gms:play-services-ads-base@@22.1.0:3)
android.os.Binder.transact (Binder.java:1200)
aga.ba (:com.google.android.gms.policy_ads_fdr_dynamite@231710101@231710100057.526733554.526733554:2)
com.google.android.gms.ads.internal.initialization.f.e (:com.google.android.gms.policy_ads_fdr_dynamite@231710101@231710100057.526733554.526733554)
com.google.android.gms.ads.nonagon.initialization.f.run (:com.google.android.gms.policy_ads_fdr_dynamite@231710101@231710100057.526733554.526733554:2)
android.os.Handler.handleCallback (Handler.java:942)
android.os.Handler.dispatchMessage (Handler.java:99)
atm.a (:com.google.android.gms.policy_ads_fdr_dynamite@231710101@231710100057.526733554.526733554)
com.google.android.gms.ads.internal.util.f.a (:com.google.android.gms.policy_ads_fdr_dynamite@231710101@231710100057.526733554.526733554:1)
atm.dispatchMessage (:com.google.android.gms.policy_ads_fdr_dynamite@231710101@231710100057.526733554.526733554)
android.os.Looper.loopOnce (Looper.java:226)
android.os.Looper.loop (Looper.java:313)
android.app.ActivityThread.main (ActivityThread.java:8757)
java.lang.reflect.Method.invoke (Native method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)



Ronald Dwk

unread,
Jun 12, 2023, 8:42:27 AM6/12/23
to Google Mobile Ads SDK Developers
Since I started using admob 8 years ago, on play store console under "Crashes & ANRs" I had millions of both crashes & anrs all related to gms dependency until version 22.0.0 not a single crash or anr after updating to 22.1.0 it started again not only crashes but on android 10 I have a interstitial ad after the splash it wouldn't load basically frozen on the splash so I downgraded to 22.0.0.

This worked for me to drastically reduce Crashes & ANRs:

AndroidManifest:

    <application

        <uses-library
            android:name="org.apache.http.legacy"
            android:required="false" />

    </application>

app build gradle:

    defaultConfig {
    useLibrary 'org.apache.http.legacy'

Mobile Ads SDK Forum Advisor

unread,
Jun 15, 2023, 10:05:21 AM6/15/23
to rona...@gmail.com, google-adm...@googlegroups.com
Hello Ronald Dwk,

You've mentioned that you were experiencing crashes and unexpected behavior when you were using version 22.1.0 of the SDK, would it be possible to provide the following so we may be able to investigate this:
  • Sample App
  • Steps to replicate
  • App ID
  • Complete Stack Trace Error
  • Device name and versions affected
  • Screen Recording
You can provide the following details via reply privately to author option or directly provide it to the link below.

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to

https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=Mobile+Ads+SDK&entry.460850823=5004Q00002mBwMAQA0&entry.80707362=00183726

2. Fill out all fields, and attach your file(s).

3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link.

This message is in relation to case "ref:_00D1U1174p._5004Q2mBwMA:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team


Mobile Ads SDK Forum Advisor

unread,
Jun 15, 2023, 10:24:45 AM6/15/23
to marcin...@ccgames.io, google-adm...@googlegroups.com

Hi Marcin,

Thanks for reaching out to the GMA SDK Forum.

I understand that you already have tried to follow guide here https://developers.google.com/admob/android/optimize-initialization but still ANR persists.

However, you may try steps below:

  • Install latest Unity 2022.3 LTS release in your app
  • Use Google Mobile Ads Android SDK 22.1.0

If the issue still persists after doing the recommendation above, you may provide us the following details via "Reply Privately to Author" option:

  1. Are there factors that cause this to happen more frequently?
  2. Does this happen in our Sample apps?
  3. Could you give us steps to replicate this ANR?
  4. App ID
  5. Ad Unit ID
  6. Full stack trace of the crash logs (text copy)
  7. Affected devices
  8. percentage occurrence of the crash

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to

2. Fill out all fields, and attach your file(s).

3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link. 

This message is in relation to case "ref:_00D1U1174p._5004Q2mBvDA:ref"


Thanks,
 
Google Logo Mobile Ads SDK Team


Ronald Geisler

unread,
Jun 20, 2023, 5:15:40 AM6/20/23
to Google Mobile Ads SDK Developers
Hi,
We also get many of these ANRs, and they increase with every new AdMob version :-(

The Play Console shows us logs like the following for initialization and ad loading (Banner, Interstitial, and Rewarded). We do not use any other mediation networks, and also OPTIMIZE_INITIALIZATION and OPTIMIZE_AD_LOADING do not help.

Now we can reproduce it on an Android Go device locally, and we figured out that this only happens when we use the Release build. On a Debug build, everything works fine without ANRs.

  #00 pc 0x000000000014c772 /system/lib/libart.so (bool art::DexFileVerifier::CheckIntraClassDataItemFields<false>(art::ClassDataItemIterator*, bool*, art::dex::TypeIndex*, art::DexFile::ClassDef const**)+137) #01 pc 0x000000000014c4e1 /system/lib/libart.so (art::DexFileVerifier::CheckIntraClassDataItem()+148) #02 pc 0x000000000014dc2f /system/lib/libart.so (art::DexFileVerifier::CheckIntraSectionIterate(unsigned int, unsigned int, art::DexFile::MapItemType)+222) #03 pc 0x000000000014e411 /system/lib/libart.so (art::DexFileVerifier::CheckIntraSection()+196) #04 pc 0x00000000001493a7 /system/lib/libart.so (art::DexFileVerifier::Verify()+26) #05 pc 0x000000000014929d /system/lib/libart.so (art::DexFileVerifier::Verify(art::DexFile const*, unsigned char const*, unsigned int, char const*, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*)+120) #06 pc 0x000000000013c791 /system/lib/libart.so (art::DexFile::OpenOneDexFileFromZip(art::ZipArchive const&, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, art::DexFile::ZipOpenErrorCode*)+612) #07 pc 0x000000000013c277 /system/lib/libart.so (art::DexFile::OpenAllDexFilesFromZip(art::ZipArchive const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, std::__1::vector<std::__1::unique_ptr<art::DexFile const, std::__1::default_delete<art::DexFile const>>, std::__1::allocator<std::__1::unique_ptr<art::DexFile const, std::__1::default_delete<art::DexFile const>>>>*)+394) #08 pc 0x000000000013beeb /system/lib/libart.so (art::DexFile::OpenZip(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, std::__1::vector<std::__1::unique_ptr<art::DexFile const, std::__1::default_delete<art::DexFile const>>, std::__1::allocator<std::__1::unique_ptr<art::DexFile const, std::__1::default_delete<art::DexFile const>>>>*)+270) #09 pc 0x000000000013bcb7 /system/lib/libart.so (art::DexFile::Open(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, std::__1::vector<std::__1::unique_ptr<art::DexFile const, std::__1::default_delete<art::DexFile const>>, std::__1::allocator<std::__1::unique_ptr<art::DexFile const, std::__1::default_delete<art::DexFile const>>>>*)+374) #10 pc 0x000000000031b199 /system/lib/libart.so (art::OatFileManager::OpenDexFilesFromOat(char const*, _jobject*, _jobjectArray*, art::OatFile const**, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>*)+4580) #11 pc 0x00000000002ea375 /system/lib/libart.so (art::DexFile_openDexFileNative(_JNIEnv*, _jclass*, _jstring*, _jstring*, int, _jobject*, _jobjectArray*)+96) #12 pc 0x0000000000191ac3 /system/framework/arm/boot-core-libart.oat (Java_dalvik_system_DexFile_openDexFileNative__Ljava_lang_String_2Ljava_lang_String_2ILjava_lang_ClassLoader_2_3Ldalvik_system_DexPathList_00024Element_2+194) at dalvik.system.DexFile.openDexFileNative (Native method) at dalvik.system.DexFile.openDexFile (DexFile.java:353) at dalvik.system.DexFile.<init> (DexFile.java:100) at dalvik.system.DexFile.<init> (DexFile.java:74) at dalvik.system.DexPathList.loadDexFile (DexPathList.java:374) at dalvik.system.DexPathList.makeDexElements (DexPathList.java:337) at dalvik.system.DexPathList.<init> (DexPathList.java:157) at dalvik.system.BaseDexClassLoader.<init> (BaseDexClassLoader.java:65) at dalvik.system.PathClassLoader.<init> (PathClassLoader.java:64) at com.android.internal.os.ClassLoaderFactory.createClassLoader (ClassLoaderFactory.java:73) at com.android.internal.os.ClassLoaderFactory.createClassLoader (ClassLoaderFactory.java:88) at android.app.ApplicationLoaders.getClassLoader (ApplicationLoaders.java:69) at android.app.ApplicationLoaders.getClassLoader (ApplicationLoaders.java:35) at android.app.LoadedApk.createOrUpdateClassLoaderLocked (LoadedApk.java:713) at android.app.LoadedApk.getClassLoader (LoadedApk.java:747) at android.app.ContextImpl.getClassLoader (ContextImpl.java:304) at com.google.android.gms.dynamic.RemoteCreator.getRemoteCreatorInstance (com.google.android.gms:play-services-basement@@18.1.0:4) at com.google.android.gms.ads.internal.client.zzeq.zza (com.google.android.gms:play-services-ads-lite@@22.1.0:2) at com.google.android.gms.ads.internal.client.zzaq.zzc (com.google.android.gms:play-services-ads-lite@@22.1.0:12) at com.google.android.gms.ads.internal.client.zzax.zzf (com.google.android.gms:play-services-ads-lite@@22.1.0:1) at com.google.android.gms.ads.internal.client.zzax.zzd (com.google.android.gms:play-services-ads-lite@@22.1.0:11) at com.google.android.gms.ads.internal.client.zzej.zzA (com.google.android.gms:play-services-ads-lite@@22.1.0:3) at com.google.android.gms.ads.internal.client.zzej.zzn (com.google.android.gms:play-services-ads-lite@@22.1.0:8) at com.google.android.gms.ads.MobileAds.initialize (com.google.android.gms:play-services-ads-lite@@22.1.0:3) at com.asgardsoft.core.ASAdManager.init (ASAdManager.java:695) at com.asgardsoft.core.ASCore.initAdMob (ASCore.java:894) at com.asgardsoft.core.ASActivity.consentCheckFinished (ASActivity.java:541) at com.asgardsoft.core.ASActivity.lambda$checkConsent$9 (ASActivity.java:617) at com.google.android.gms.internal.consent_sdk.zzs.run (com.google.android.ump:user-messaging-platform@@2.0.0:1) at android.os.Handler.handleCallback (Handler.java:795) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loop (Looper.java:166) at android.app.ActivityThread.main (ActivityThread.java:6861) at java.lang.reflect.Method.invoke (Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:450) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)

Device Log:

10:26:41.774 ActivityManager            E  ANR in com.asgardsoft.connect (com.asgardsoft.connect/com.asgardsoft.core.ASActivity)
                                           PID: 19139
                                           Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 2.  Wait queue head age: 5513.2ms.)
                                           Parent: com.asgardsoft.connect/com.asgardsoft.core.ASActivity
                                           Load: 9.21 / 8.55 / 8.41
                                           CPU usage from 0ms to 19885ms later (2023-06-20 10:26:21.764 to 2023-06-20 10:26:41.648):
                                             156% 19139/com.asgardsoft.connect: 124% user + 32% kernel / faults: 78154 minor 1 major
                                             52% 7370/com.google.android.gms: 46% user + 5.6% kernel / faults: 35952 minor 2987 major
                                             21% 990/system_server: 12% user + 9.3% kernel / faults: 10403 minor 21 major
                                             18% 684/media.codec: 8.8% user + 10% kernel / faults: 34201 minor 1 major
                                             15% 363/surfaceflinger: 8.5% user + 7.4% kernel / faults: 389 minor
                                             14% 347/android.hardware....@2.1-service: 6.4% user + 7.7% kernel / faults: 6599 minor
                                             8.9% 358/audioserver: 7.8% user + 1.1% kernel / faults: 355 minor
                                             6% 344/android.har...@5.0-service-mediatek: 4.1% user + 1.9% kernel / faults: 37 minor
                                             5.9% 677/mediaserver: 3.6% user + 2.3% kernel / faults: 610 minor
                                             5.7% 1135/com.android.systemui: 3.7% user + 1.9% kernel / faults: 6557 minor 9 major
                                             4.8% 1730/adbd: 1.2% user + 3.5% kernel / faults: 645 minor
                                             4.4% 17394/kworker/u9:6: 0% user + 4.4% kernel
                                             4.3% 19089/kworker/u9:3: 0% user + 4.3% kernel
                                             3.4% 675/media.extractor: 2.6% user + 0.8% kernel / faults: 8327 minor
                                             2.1% 15799/kworker/u9:5: 0% user + 2.1% kernel
                                             1.9% 5657/com.android.phone: 1.3% user + 0.6% kernel / faults: 1307 minor 2 major
                                             1.8% 1320/tx_thread: 0% user + 1.8% kernel
                                             1.8% 13099/kworker/u9:0: 0% user + 1.8% kernel
                                             1.5% 273/logd: 0.3% user + 1.1% kernel / faults: 14 minor
                                             1.3% 696/vendor.mediat...@2.2-service: 0.7% user + 0.6% kernel
                                             0% 698/media.swcodec: 0% user + 0% kernel / faults: 497 minor
                                             0.9% 12836/kworker/u8:2: 0% user + 0.9% kernel
                                             0.8% 1652/com.google.android.gms.persistent: 0.6% user + 0.2% kernel / faults: 187 minor
                                             0.8% 17983/kworker/u8:0: 0% user + 0.8% kernel
                                             0.7% 152/pbm: 0% user + 0.7% kernel
                                             0.7% 1784/com.android.se: 0.5% user + 0.2% kernel / faults: 940 minor 1 major
                                             0.1% 1216/com.elephanttek.faceunlock: 0% user + 0% kernel / faults: 897 minor 1 major
                                             0.6% 357/ashmemd: 0.3% user + 0.3% kernel / faults: 253 minor
                                             0.6% 8045/logcat: 0.2% user + 0.4% kernel / faults: 408 minor
                                             0.6% 8331/logcat: 0.2% user + 0.4% kernel / faults: 408 minor
                                             0.6% 18609/kworker/u8:1: 0% user + 0.6% kernel
                                             0.6% 13793/kworker/u8:4: 0% user + 0.6% kernel
                                             0.5% 7/rcu_preempt: 0% user + 0.5% kernel
                                             0.4% 679/netd: 0.1% user + 0.3% kernel / faults: 204 minor
                                             0.3% 213/mmcqd/0: 0% user + 0.3% kernel
                                             0.3% 13489/kworker/2:1: 0% user + 0.3% kernel
                                             0.3% 355/vendor.mediatek....@1.0-service: 0% user + 0.2% kernel / faults: 2 minor
                                             0.3% 6752/kworker/1:1: 0% user + 0.3% kernel
                                             0.2% 180/present_fence_w: 0% user + 0.2% kernel
                                             0.2% 18298/kworker/0:0: 0% user + 0.2% kernel
                                             0.2% 275/hwservicemanager: 0.1% user + 0.1% kernel / faults: 257 minor
                                             0.2% 311/android.sys...@1.0-service: 0% user + 0.1% kernel
                                             0.2% 352/merged_hal_service: 0% user + 0.1% kernel / faults: 81 minor
                                             0.2% 681/statsd: 0.1% user + 0.1% kernel / faults: 266 minor
                                             0% 715/tombstoned: 0% user + 0% kernel / faults: 129 minor
                                             0.1% 61/cfinteractive: 0% user + 0.1% kernel
                                             0.1% 181/frame_update_wo: 0% user + 0.1% kernel
                                             0.1% 361/lmkd: 0% user + 0.1% kernel
                                             0.1% 662/mnld: 0% user + 0.1% kernel / faults: 44 minor
                                             0.1% 154/hps_main: 0% user + 0.1% kernel
                                             0.1% 233/mtk-tpd: 0% user + 0.1% kernel
                                             0.1% 11935/com.google.android.ims: 0% user + 0% kernel / faults: 18 minor
                                             0% 1/init: 0% user + 0% kernel
                                             0% 20/ksoftirqd/2: 0% user + 0% kernel
                                             0% 178/display_esd_che: 0% user + 0% kernel
                                             0% 208/wdtk-0: 0% user + 0% kernel
                                             0% 263/kworker/1:1H: 0% user + 0% kernel
                                             0% 268/ueventd: 0% user + 

Thanks
Ronald

Marcin Małysz

unread,
Jun 29, 2023, 8:58:25 AM6/29/23
to Google Mobile Ads SDK Developers
Hi

Yes we already tried the optimize initialization and as we are using Unity SDK 8.3.0 for AdMob we are targeting Google Mobile Ads Android SDK 22.1.0 we will update to latest Unity LTS version soon. 

I'm attaching the full ANR log from Crashlytics 

Thanks!

On Thursday, June 15, 2023 at 4:24:45 PM UTC+2 Mobile Ads SDK Forum Advisor wrote:
pl.lukok.chess_issue_b647c92993693505e3a89daeaf82c442_ANR_session_649D7D9002200001161CB7B9ABFC9159_DNE_0_v2_stacktrace.txt

Mobile Ads SDK Forum Advisor

unread,
Jun 29, 2023, 12:59:23 PM6/29/23
to marcin...@ccgames.io, google-adm...@googlegroups.com

Hi Marcin,

Thank you for your response.

Let me share this to the wider team to further investigate this ANR. We will update you once we have more information.

Mobile Ads SDK Forum Advisor

unread,
Jun 30, 2023, 1:43:50 AM6/30/23
to marcin...@ccgames.io, google-adm...@googlegroups.com
Hello Marcin,

Thank you for waiting. Our team has completed the investigation and it appears that the ANR happened when the main thread is executing native code, which is out of GMA SDK's control. The GMA SDK is just happened to be on the main thread, which is one of the many calls that needs the JNI to translate Android to c#.

These ANR is probably on the Unity engine side, as there are other similar ANRs reported from external links: https://forum.unity.com/threads/anr-il2cpp-com-unity3d-player-reflectionhelper-nativeproxyinvoke.1012210/. We recommend reaching out to Unity's support team instead for further assistance.

Reply all
Reply to author
Forward
0 new messages