1

我从 AdMob 切换到 UnityAds,现在我的游戏在玩家尝试购买东西后崩溃。

java.lang.RuntimeException: Error receiving broadcast Intent { act=com.android.vending.billing.PURCHASES_UPDATED flg=0x10 pkg=ru.elvale.amfus (has extras) } in com.android.billingclient.api.zzg@6336d8f
    at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1560)
    at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7403)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
 Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
    at com.unity3d.services.store.gpbl.proxies.PurchaseUpdatedListenerProxy.onPurchasesUpdated(PurchaseUpdatedListenerProxy.java:46)
    at com.unity3d.services.store.gpbl.proxies.PurchaseUpdatedListenerProxy.invoke(PurchaseUpdatedListenerProxy.java:32)
    at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
    at $Proxy4.onPurchasesUpdated(Unknown Source)
    at com.android.billingclient.api.zzg.onReceive(com.android.billingclient:billing@@4.0.0:3)
    at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1550)
    at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2) 
    at android.os.Handler.handleCallback(Handler.java:883) 
    at android.os.Handler.dispatchMessage(Handler.java:100) 
    at android.os.Looper.loop(Looper.java:214) 
    at android.app.ActivityThread.main(ActivityThread.java:7403) 

我看到了com.unity3d.services.store.gpbl.proxies.PurchaseUpdatedListenerProxy.onPurchasesUpdated,但我只想使用 UnityAds 来展示广告,分析未连接,我该如何禁用它?

4

1 回答 1

2

我向 Unity 官方支持寻求帮助,我们发现了问题。
问题在于默认启用的 Unity Analytics Collection。

Unity Ads 尝试将数据发送到仪表板。但是目前,Unity Ads 使用的是 Google Billing Library v3,当我是 v4 时,它在提交数据时导致了错误。

找到了2个解决方案:

  • 在 v3 下重写我的计费代码
  • 禁用 Unity Analytics Collection on Monetization 文件夹到仪表板
于 2022-01-13T06:49:20.823 回答