After updating com.unity.purchasing from 4.1.3 to 4.4.1 we’ve started receiving some ANR reports in crashlytics:
Android Main Thread:
com.android.billingclient.api.zzaf.zzd (com.android.billingclient:billing@@4.0.0)
com.android.billingclient.api.zzaf.zzb (com.android.billingclient:billing@@4.0.0:3)
com.android.billingclient.api.zzad.run (com.android.billingclient:billing@@4.0.0)
com.android.billingclient.api.zzw.run (com.android.billingclient:billing@@4.0.0:4)
android.os.Handler.handleCallback (Handler.java:938)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loop (Looper.java:236)
android.app.ActivityThread.main (ActivityThread.java:7864)
java.lang.reflect.Method.invoke (Native method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:620)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1011)
PlayBillingLibrary-2 Thread:
com.unity3d.player.ReflectionHelper.nativeProxyLogJNIInvokeException (Native method)
com.unity3d.player.ReflectionHelper.acom.unity3d.player.ReflectionHelper$1.invoke
java.lang.reflect.Proxy.invoke (Proxy.java:1006)
com.android.billingclient.api.BillingClientStateListener.onBillingSetupFinished (com.android.billingclient:billing@@4.0.0)
com.android.billingclient.api.zzaf.zzd (com.android.billingclient:billing@@4.0.0:1)
com.android.billingclient.api.zzaf.zza (com.android.billingclient:billing@@4.0.0:26)
com.android.billingclient.api.zzae.call (com.android.billingclient:billing@@4.0.0)
java.util.concurrent.FutureTask.run (FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
java.lang.Thread.run (Thread.java:923)
There’s also this different one:
Android Main Thread:
com.unity3d.player.ReflectionHelper.nativeProxyLogJNIInvokeException (Native method)
com.unity3d.player.ReflectionHelper.acom.unity3d.player.ReflectionHelper$1.invoke
java.lang.reflect.Proxy.invoke (Proxy.java:1006)
com.android.billingclient.api.BillingClientStateListener.onBillingServiceDisconnected (com.android.billingclient:billing@@4.0.0)
com.android.billingclient.api.zzaf.onServiceDisconnected (com.android.billingclient:billing@@4.0.0:4)
android.app.LoadedApk$ServiceDispatcher.doDeath (LoadedApk.java:2260)
android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:2275)
android.os.Handler.handleCallback (Handler.java:938)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loopOnce (Looper.java:226)
android.os.Looper.loop (Looper.java:313)
android.app.ActivityThread.main (ActivityThread.java:8669)
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:1135)
We’re using Unity 2020.3.34f1.
Unfortunately we couldn’t reproduce this issue, but it’s pretty clear that it started when Unity IAP migrated to the Google Play Billing v4 library.
Is there anything we can do the prevent this?