Admob Causing ANR when closing Ads
See original GitHub issue[REQUIRED] Step 1: Describe your environment
- Unity version: 2019.4.30f1
- Google Mobile Ads Unity plugin version: 6.1.2
- Platform: _____ Android
- Platform OS version: _____ ( Android 11 )
- Any specific devices issue occurs on: _____
- Mediation ad networks used, and their versions: IronSrc(v7.1.8.0), Facebook(v6.5.1.1), Unity(v3.7.5.0), InMobi (9.2.0.0)
[REQUIRED] Step 2: Describe the problem
We are getting a Random ANR at firebase crashlytics and we are not able to repro it.
#### Root Blocking
Binder:18236_F (native): tid=6 systid=29723
#00 pc 0x9c7c8 libc.so
#01 pc 0x5a87c libc.so
#02 pc 0x7c55c base.apk!libconscrypt_gmscore_jni.so
#03 pc 0x7ca00 base.apk!libconscrypt_gmscore_jni.so
#04 pc 0x75464 base.apk!libconscrypt_gmscore_jni.so
at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_read(Native method)
at com.google.android.gms.org.conscrypt.NativeSsl.read(:com.google.android.gms@214815039@21.48.15 (150408-414534850):3)
at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read(:com.google.android.gms@214815039@21.48.15 (150408-414534850):6)
at com.android.okhttp.okio.Okio$2.read(Okio.java:138)
at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:213)
at com.android.okhttp.okio.RealBufferedSource.read(RealBufferedSource.java:51)
at com.android.okhttp.internal.http.Http1xStream$FixedLengthSource.read(Http1xStream.java:395)
at com.android.okhttp.okio.RealBufferedSource$1.read(RealBufferedSource.java:372)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:347)
at android.media.MediaHTTPConnection.readAt(MediaHTTPConnection.java:404)
at android.media.MediaHTTPConnection.native_readAt(Native method)
at android.media.MediaHTTPConnection.readAt(MediaHTTPConnection.java:390)
at android.media.IMediaHTTPConnection$Stub.onTransact(IMediaHTTPConnection.java:143)
at android.os.Binder.execTransactInternal(Binder.java:1174)
at android.os.Binder.execTransact(Binder.java:1126)
#### Triggered ANR: -
main (unknown): tid=1 systid=18236
at android.media.MediaHTTPConnection.disconnect(MediaHTTPConnection.java:172)
at android.media.IMediaHTTPConnection$Stub.onTransact(IMediaHTTPConnection.java:132)
at android.os.Binder.execTransactInternal(Binder.java:1174)
at android.os.Binder.execTransact(Binder.java:1126)
at android.media.MediaPlayer._release(Native method)
at android.media.MediaPlayer.release(MediaPlayer.java:2121)
at android.widget.VideoView.stopPlayback(VideoView.java:365)
at com.unity3d.services.ads.adunit.VideoPlayerHandler.destroy(VideoPlayerHandler.java:38)
at com.unity3d.services.ads.adunit.VideoPlayerHandler.onPause(VideoPlayerHandler.java:74)
at com.unity3d.services.ads.adunit.AdUnitActivity.onPause(AdUnitActivity.java:219)
at android.app.Activity.performPause(Activity.java:8271)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1510)
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5039)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5000)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4951)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:46)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2207)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:268)
at android.app.ActivityThread.main(ActivityThread.java:8067)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
Steps to reproduce:
Unable to Repro.
More Info :- We are getting strict policy violation at Google play. Well Can this okhttp version be the cause ?
com.squareup.okhttp3:okhttp:3.12.1 from dependency Graph
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lcom/android/org/conscrypt/ConscryptEngineSocket;->setHostname(Ljava/lang/String;)V
at android.os.StrictMode.lambda$static$1(StrictMode.java:416)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredMethodInternal(Native Method)
at java.lang.Class.getPublicMethodRecursive(Class.java:2079)
at java.lang.Class.getMethod(Class.java:2066)
at java.lang.Class.getMethod(Class.java:1693)
at okhttp3.internal.platform.OptionalMethod.getPublicMethod(OptionalMethod.java:164)
at okhttp3.internal.platform.OptionalMethod.getMethod(OptionalMethod.java:149)
at okhttp3.internal.platform.OptionalMethod.invokeOptional(OptionalMethod.java:66)
at okhttp3.internal.platform.OptionalMethod.invokeOptionalWithoutCheckedException(OptionalMethod.java:86)
at okhttp3.internal.platform.AndroidPlatform.configureTlsExtensions(AndroidPlatform.java:123)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:314)
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:283)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:168)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:200)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ljava/net/Socket;->impl:Ljava/net/SocketImpl;
at android.os.StrictMode.lambda$static$1(StrictMode.java:416)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredField(Native Method)
at com.google.android.gms.org.conscrypt.Platform.getFileDescriptor(:com.google.android.gms@213918046@21.39.18 (150400-407637301):1)
at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read(:com.google.android.gms@213918046@21.39.18 (150400-407637301):6)
at com.android.okhttp.okio.Okio$2.read(Okio.java:138)
at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:213)
at com.android.okhttp.okio.RealBufferedSource.exhausted(RealBufferedSource.java:61)
at com.android.okhttp.internal.io.RealConnection.isHealthy(RealConnection.java:365)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:139)
at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:262)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:219)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:30)
at com.google.android.gms.internal.firebase-auth-api.zzvb.zza(com.google.firebase:firebase-auth@@21.0.1:10)
at com.google.android.gms.internal.firebase-auth-api.zzul.zzg(com.google.firebase:firebase-auth@@21.0.1:4)
at com.google.android.gms.internal.firebase-auth-api.zzpt.zzO(com.google.firebase:firebase-auth@@21.0.1:5)
at com.google.android.gms.internal.firebase-auth-api.zzpt.zzb(com.google.firebase:firebase-auth@@21.0.1:1)
at com.google.android.gms.internal.firebase-auth-api.zzpn.zzb(com.google.firebase:firebase-auth@@21.0.1:7)
at com.google.android.gms.internal.firebase-auth-api.zzvb.zza(com.google.firebase:firebase-auth@@21.0.1:25)
at com.google.android.gms.internal.firebase-auth-api.zzul.zzn(com.google.firebase:firebase-auth@@21.0.1:4)
at com.google.android.gms.internal.firebase-auth-api.zzpt.zzz(com.google.firebase:firebase-auth@@21.0.1:3)
at com.google.android.gms.internal.firebase-auth-api.zztp.zzu(com.google.firebase:firebase-auth@@21.0.1:4)
at com.google.android.gms.internal.firebase-auth-api.zzrz.zzd(com.google.firebase:firebase-auth@@21.0.1:3)
at com.google.android.gms.internal.firebase-auth-api.zzry.accept(Unknown Source:6)
at com.google.android.gms.common.api.internal.zacr.doExecute(com.google.android.gms:play-services-base@@17.6.0:1)
at com.google.android.gms.common.api.internal.zag.zaf(com.google.android.gms:play-services-base@@17.6.0:1)
at com.google.android.gms.common.api.internal.zabl.zaG(com.google.android.gms:play-services-base@@17.6.0:2)
at com.google.android.gms.common.api.internal.zabl.zaF(com.google.android.gms:play-services-base@@17.6.0:5)
at com.google.android.gms.common.api.internal.zabl.zad(com.google.android.gms:play-services-base@@17.6.0:3)
at com.google.android.gms.common.api.internal.GoogleApiManager.handleMessage(com.google.android.gms:play-services-base@@17.6.0:64)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (1 by maintainers)
Top Results From Across the Web
ANRs and the challenge to show ads | by Federico Gaule
ANRs appear when your application is unresponsive for more than 5 seconds, so it's hard to find out the cause by just looking...
Read more >Admob library causes ANR problems to the App
I'm using the latest com.google.firebase:firebase-ads:15.0.1 for Interstitial Ads. In some circumstances Admob library causes ANR errors like this:
Read more >ANR caused by google Interstitial ads - android
In the google play console - I keep getting ANR caused by google Interstitial ads. the application probably freeze for 0.5 seconds or...
Read more >Disallowed interstitial implementations - Google AdMob Help
Repeated interstitial ads often lead to poor user experiences and accidental clicks. Examples of non-compliant implementations include but are not limited to:.
Read more >Android - ANR rate too high - "Input dispatching timed out" ...
Well, the temporary fix that worked for me was to reduce ad ... RAM size and exclude systems which cause the most ANRs...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For those who are considering changing the mediation system:
We published our game in October 2021(only with Admob Mediation). By the end of November, our ANR rate exceeded 4%. As a result, our rankings and downloads dropped drastically and we lost our momentum. Because of this, we had to completely abandon Admob. We switched to Ironsource Mediation and our ANR rate dropped below 1% from the first month and below the threshold after the second month. Now our rankings are starting to return to normal and our daily downloads have increased nearly eightfold. However, the ad revenue is about 35% lower than Admob.
We’re happy for now, but it would be great to have the issue resolved and to be able to use Admob again…
What is the state of the issue? More than half a year Admob team promises to implement a fix and still no results