对于拥有数百万活跃用户的游戏,我使用InApp Billing V3并调用getSkuDetails来加载我的应用内商品的价格。
我从一个单独的线程调用getSkuDetails,但仍然会发生ANR。
有没有人面对类似的ANR?或者我做错了什么?
这是ANR堆栈:
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 obj=0x73f81268 self=0xa7f85400
| sysTid=16197 nice=0 cgrp=default sched=0/0 handle=0xaac0e534
| state=S schedstat=( 0 0 0 ) utm=124 stm=29 core=2 HZ=100
| stack=0xbe73e000-0xbe740000 stackSize=8MB
| held mutexes=
#00 pc 0000000000048618 /system/lib/libc.so (__ioctl+8)
#01 pc 000000000001adef /system/lib/libc.so (ioctl+38)
#02 pc 000000000003c1bb /system/lib/libbinder.so (_ZN7android14IPCThreadState14talkWithDriverEb+170)
#03 pc 000000000003caf3 /system/lib/libbinder.so (_ZN7android14IPCThreadState15waitForResponseEPNS_6ParcelEPi+238)
#04 pc 0000000000035f11 /system/lib/libbinder.so (_ZN7android8BpBinder8transactEjRKNS_6ParcelEPS1_j+36)
#05 pc 00000000000959a1 /system/lib/libandroid_runtime.so (???)
#06 pc 00000000005e9bf1 /system/framework/arm/boot-framework.oat (Java_android_os_BinderProxy_transactNative__ILandroid_os_Parcel_2Landroid_os_Parcel_2I+140)
at android.os.BinderProxy.transactNative (BinderProxy.java)
at android.os.BinderProxy.transact (BinderProxy.java:641)
at com.android.vending.billing.IInAppBillingService$Stub$Proxy.getSkuDetails (IInAppBillingService.java:370)
at com.mygame.mygame.GameActivity.lambda$getRemoveAdsPrice$2$GameActivity (GameActivity.java:759)
at com.mygame.mygame.GameActivity$$Lambda$2.run (GameActivity.java)
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:6153)
at java.lang.reflect.Method.invoke! (Native method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:755)