googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.38k stars 1.08k forks source link

ANR on Android #707

Closed msureka closed 6 years ago

msureka commented 6 years ago

Title: 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: 10. Wait queue head age: 21118.3ms.) com.google.android.gms.ads.AdActivity

OS: Android 7.0 Device: Galaxy J7 Reported by Google Play ANRs

Using Google Ads Unity SDK & Google Play Services.

"main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 obj=0x7615fc78 self=0xe5205400 | sysTid=31683 nice=-4 cgrp=default sched=0/0 handle=0xe8478534 | state=S schedstat=( 0 0 0 ) utm=1359 stm=453 core=2 HZ=100 | stack=0xff328000-0xff32a000 stackSize=8MB | held mutexes=

00 pc 000000000004a468 /system/lib/libc.so (nanosleep+12)

01 pc 00000000003cedec /data/app/com.xxx.xxx-2/lib/arm/libunity.so (???)

02 pc 00000000005fc23c /data/app/com.xxx.xxx-2/lib/arm/libunity.so (???)

03 pc 00000000001286cc /data/app/com.xxx.xxx-2/lib/arm/libmono.so (???)

04 pc 00000000000221e8 /data/app/com.xxx.xxx-2/lib/arm/libmono.so (???)

05 pc 00000000002c0b31 /data/app/com.xxx.xxx-2/lib/arm/libmono.so (???)

06 pc 00000000000087c1 /system/bin/app_process32 (InvokeUserSignalHandler+156)

07 pc 000000000014aba3 /system/lib/libart.so (_ZN3art12FaultManager11HandleFaultEiP7siginfoPv+222)

08 pc 00000000000171d0 /system/lib/libc.so (???)

at com.unity3d.player.ReflectionHelper.nativeProxyInvoke (Native method) at com.unity3d.player.ReflectionHelper.a (unavailable) at com.unity3d.player.ReflectionHelper$1.invoke (unavailable) at java.lang.reflect.Proxy.invoke (Proxy.java:813) at com.google.unity.ads.UnityRewardBasedVideoAdListener.onAdRewarded (UnityRewardBasedVideoAdListener.java) at com.google.unity.ads.RewardBasedVideo$1$1.onRewarded (RewardBasedVideo.java:95) at com.google.android.gms.internal.zzafh.zza (unavailable) at com.google.android.gms.internal.zzafd.onTransact (unavailable) at android.os.Binder.transact (Binder.java:507) at com.google.android.gms.ads.internal.webview.ab.run (unavailable:8) at android.os.Handler.handleCallback (Handler.java:751) at android.os.Handler.dispatchMessage (Handler.java:95) at android.os.Looper.loop (Looper.java:154) at android.app.ActivityThread.main (ActivityThread.java:6776) at java.lang.reflect.Method.invoke! (Native method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1496) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1386)

waqasahmeddevbatch commented 6 years ago

I have same issue, Please let me now how to resolve it?

Evantko commented 6 years ago

Same issue.

Need help

dermarder commented 6 years ago

Same here.

msureka commented 6 years ago

@rampara can you please look into this?

rampara commented 6 years ago

@msureka this issue does seem to come from the Unity JNI bridge. Currently investigating alternative ways to forward ad events from GMA SDK to the Unity plugin that are less ANR-prone.

waqasahmeddevbatch commented 6 years ago

@rampara please help me, how can we move Ads event from GMA SDK to Unity Plugin that is more stable? As this issue causing so many ANRs and it directly impact to our Android Vitals. Vitals threshold are directly responsible for game discovery.

Please help me the way around.

msureka commented 6 years ago

@rampara Yes, @waqasahmeddevbatch is correct. With the new algorithm of Google Play, discovery is massively affected due to poor Vitals (ANRs & Crash). We are facing several ANRs and crashes due to the GMA SDK, but since it seems the only way to integrate Google Ads, we can't remove it.

Please treat the ANRs and Crashes on priority.

Thanks!

rampara commented 6 years ago

@msureka @waqasahmeddevbatch @dermarder @Evantko just pushed v3.15.0 of this plugin which includes changes to mitigate this issue. Can you give that a try and let me know if ANRs are no longer as prominent.

waqasahmeddevbatch commented 6 years ago

@rampara thanks for the update, We have implemented this version in our latest game and will update the outcomes in this threads soon.

rampara commented 6 years ago

Will keep the issue open while waiting on feedback.

msureka commented 6 years ago

Still got ANR with new plugin:

Android 6.0 Motorola Moto G (3rd Edition)

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: 4. Wait queue head age: 13238.1ms.), VisibleToUser com.unity3d.player.UnityPlayerActivity

"main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 obj=0x734292a0 self=0xb8d9fd18 | sysTid=27652 nice=-4 cgrp=default sched=0/0 handle=0xb6f1cb34 | state=D schedstat=( 1763800860 276844398 3888 ) utm=86 stm=90 core=2 HZ=100 | stack=0xbe1b8000-0xbe1ba000 stackSize=8MB | held mutexes=

00 pc 0000000000af2da8 /data/app/com.google.android.webview-2/lib/arm/libwebviewchromium.so (???)

at org.chromium.content.browser.framehost.NavigationControllerImpl.nativeLoadUrl (Native method) at org.chromium.content.browser.framehost.NavigationControllerImpl.loadUrl (NavigationControllerImpl.java:67) at org.chromium.android_webview.AwContents.loadUrl (AwContents.java:491) at org.chromium.android_webview.AwContents.loadUrl (AwContents.java:370) at org.chromium.android_webview.AwContents.loadUrl (AwContents.java:375) at com.android.webview.chromium.WebViewChromium.loadUrl (WebViewChromium.java:248) at android.webkit.WebView.loadUrl (WebView.java:894) at com.google.android.gms.ads.internal.js.z.run (unavailable:26) at android.os.Binder.transact (Binder.java:387) at com.google.android.gms.internal.ads.zzej.transactAndReadException (unavailable) at com.google.android.gms.internal.ads.zzku.zzb (unavailable) at com.google.android.gms.internal.ads.zzma.zza (unavailable) at com.google.android.gms.ads.InterstitialAd.loadAd (unavailable) at com.google.unity.ads.Interstitial$2.run (Interstitial.java:152) at android.os.Handler.handleCallback (Handler.java:746) at android.os.Handler.dispatchMessage (Handler.java:95) at android.os.Looper.loop (Looper.java:148) at android.app.ActivityThread.main (ActivityThread.java:5443) at java.lang.reflect.Method.invoke! (Native method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:618)

msureka commented 6 years ago

Another ANR:

Android 7.0 Xiaomi Redmi Note 4

Input dispatching timed out (com.company.gamename/com.unity3d.player.UnityPlayerActivity, 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: 3. Wait queue head age: 8609.3ms.) com.unity3d.player.UnityPlayerActivity

"main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 obj=0x73e0c078 self=0xe5211000 | sysTid=3866 nice=0 cgrp=default sched=1073741825/1 handle=0xe83d3538 | state=S schedstat=( 215056102 3759321 307 ) utm=12 stm=9 core=6 HZ=100 | stack=0xff774000-0xff776000 stackSize=8MB | held mutexes=

00 pc 00000000000174e8 /system/lib/libc.so (syscall+32)

01 pc 000000000004691d /system/lib/libc.so (_ZL24__pthread_cond_timedwaitP23pthread_cond_internal_tP15pthread_mutex_tbPK8timespec+102)

02 pc 000000000010ab19 /data/app/com.company.gamename-2/lib/arm/libgpg.so (_ZNSt18condition_variable17__wait_until_implINSt6chrono8durationIxSt5ratioILx1ELx1000000000EEEEEESt9cv_statusRSt11unique_lockISt5mutexERKNS1_10time_pointINS1_3_V212system_clockET_EE+56)

03 pc 000000000010abc5 /data/app/com.company.gamename-2/lib/arm/libgpg.so (???)

04 pc 000000000011110f /data/app/com.company.gamename-2/lib/arm/libgpg.so (_ZN3gpg23AndroidGameServicesImpl14PerformSignOutEb+458)

05 pc 0000000000145129 /data/app/com.company.gamename-2/lib/arm/libgpg.so (_ZN3gpg16GameServicesImpl19HandleForcedSignOutEv+216)

06 pc 0000000000106661 /data/app/com.company.gamename-2/lib/arm/libgpg.so (_ZN3gpg23AndroidGameServicesImpl28AchievementFetchAllOperation9TranslateEONS_13JavaReferenceE+28)

07 pc 00000000001063fd /data/app/com.company.gamename-2/lib/arm/libgpg.so (???)

08 pc 00000000001068c3 /data/app/com.company.gamename-2/lib/arm/libgpg.so (_ZNSt17_Function_handlerIFvN3gpg13JavaReferenceEENS0_14CallbackHelperINS0_23AndroidGameServicesImpl28AchievementFetchAllOperationEEEE9_M_invokeERKSt9_AnydataS1+28)

09 pc 0000000000117f35 /data/app/com.company.gamename-2/lib/arm/libgpg.so (???)

10 pc 0000000000118123 /data/app/com.company.gamename-2/lib/arm/libgpg.so (_ZN3gpg14NativeOnResultEP7_JNIEnvP8jobjectS3+30)

11 pc 000000000000011d /data/data/com.company.gamename/app_.gpg.classloader/a67d5dc2a1b2b8b1fab5e8f920120ade_games.dex (Java_com_google_android_gms_games_NativeSdkCallbacks_onResult__Lcom_google_android_gms_common_api_Result_2+96)

at com.google.android.gms.games.NativeSdkCallbacks.onResult (Native method) at com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler.handleMessage (unavailable) at android.os.Handler.dispatchMessage (Handler.java:102) at android.os.Looper.loop (Looper.java:165) at android.app.ActivityThread.main (ActivityThread.java:6365) at java.lang.reflect.Method.invoke! (Native method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:883) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:773)

waqasahmeddevbatch commented 6 years ago

Still have ANRs issue with update AdMob SDK. I'm using Unity 2018.1.2f1 minSDKVersion 21 targetSDKVersion 27 One of the ANRs Cluster report pasted below.

_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: 27. Wait queue head age: 5560.7ms.)

com.unity3d.player.UnityPlayerActivity

DEXP ES355 (ES355), Android 6.0 Report 1 of 2

EXPAND ALL "main" tid=1 Blocked "main" prio=5 tid=1 Blocked | group="main" sCount=1 dsCount=0 obj=0x74529668 self=0xb4d76500 | sysTid=16352 nice=-4 cgrp=default sched=0/0 handle=0xb6f40c00 | state=S schedstat=( 0 0 0 ) utm=117 stm=53 core=0 HZ=100 | stack=0xbe1b2000-0xbe1b4000 stackSize=8MB | held mutexes= at android.os.Handler.handleCallback (Handler.java:739) at android.os.Handler.dispatchMessage (Handler.java:95) at android.os.Looper.loop (Looper.java:148) at android.app.ActivityThread.main (ActivityThread.java:5452) at java.lang.reflect.Method.invoke! (Native method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:762) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:652)_

screen shot 2018-08-06 at 11 26 42 am

rampara commented 6 years ago

@msureka the first ANR trace you provided is caused by the GMA SDK and not this plugin. I would recommend reporting that issue on the Google Mobile Ads Technical Support Forum. It looks like second ANR is caused by Google Play games. Are you including that plugin in your app? If so, you would need to report the issue on the issue tracker for that plugin

rampara commented 6 years ago

@waqasahmeddevbatch can you provide full ANR logs?

waqasahmeddevbatch commented 6 years ago

@rampara Here are the Full ANR log

DEXP ES355 (ES355), Android 6.0 Report 1 of 2

COLLAPSE ALL "main" tid=1 Blocked "main" prio=5 tid=1 Blocked | group="main" sCount=1 dsCount=0 obj=0x74529668 self=0xb4d76500 | sysTid=16352 nice=-4 cgrp=default sched=0/0 handle=0xb6f40c00 | state=S schedstat=( 0 0 0 ) utm=117 stm=53 core=0 HZ=100 | stack=0xbe1b2000-0xbe1b4000 stackSize=8MB | held mutexes= at android.os.Handler.handleCallback (Handler.java:739) at android.os.Handler.dispatchMessage (Handler.java:95) at android.os.Looper.loop (Looper.java:148) at android.app.ActivityThread.main (ActivityThread.java:5452) at java.lang.reflect.Method.invoke! (Native method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:762) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:652) "ReferenceQueueDaemon" tid=3 Waiting "ReferenceQueueDaemon" daemon prio=5 tid=3 Waiting | group="system" sCount=1 dsCount=0 obj=0x12c1dfa0 self=0xb4d76a00 | sysTid=16358 nice=0 cgrp=default sched=0/0 handle=0xb436f930 | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100 | stack=0xb426d000-0xb426f000 stackSize=1038KB | held mutexes= at java.lang.Object.wait! (Native method)

msureka commented 6 years ago

I am not using any GMA SDK. I’m only using this plugin for serving Google Ads (Admob) in our Unity game. Don’t think there is any other SDK that can be used to serve ads in Unity.

We are also using the official Google Play Games SDK as mentioned by Google. Note: There is a conflict if we use Tye latest releases of both the plugins.

Please advice,

Mohit

On 07-Aug-2018, at 7:43 PM, rampara notifications@github.com wrote:

@msureka the first ANR trace you provided is caused by the GMA SDK and not this plugin. I would recommend reporting that issue on the Google Mobile Ads Technical Support Forum. It looks like second ANR is caused by Google Play games. Are you including that plugin in your app? If so, you would need to report the issue on the issue tracker for that plugin

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHview it on GitHubub, or mute the thread.

rampara commented 6 years ago

@msureka by GMA SDK, I was referring to the Google Mobile Ads SDK, which is used by this plugin to request and display ads.

@waqasahmeddevbatch the log you posted does not seem to be caused by this plugin.

waqasahmeddevbatch commented 6 years ago

@rampara I'm not using any other plugin or SDK except AdMob SDK in my game. I think com.google.android.gms.internal.measurement unavailability is the main reason of this ANR, but I'm not sure. Still if this is not causing by this Plugin then please suggest any way around to get rid of this ANRs issue (As both GA & GMA linked with each other) as it's direct impacting visibility of our games day by day. We have waited for a long time but got no success yet.

rampara commented 6 years ago

@waqasahmeddevbatch I would recommend you reach out on the Google Mobile Ads Technical Support Forum for issues regarding the Google Mobile Ads SDK. This issue tracker is only for issues with the Google Mobile Ads Unity plugin.

waqasahmeddevbatch commented 6 years ago

I have reached out to GMA team in following thread but can't found any solution yet. Link to Issue Thread at GMA Forum

rampara commented 6 years ago

For ANR issues not directly caused by the plugin (caused by Google Play services instead) can you reach out on the Google Mobile Ads Technical Support Forum with ANR logs and the version of Google Play services used to build your app.