javaunity-game-enginein-app-purchaseunityads

Unity Ads and Google Play Billing Library


I switched from AdMob to UnityAds and now my game crashes after a player tries to buy something.

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) 

I saw com.unity3d.services.store.gpbl.proxies.PurchaseUpdatedListenerProxy.onPurchasesUpdated, but I want to use UnityAds only for displaying ads, analytics is not connected, how can I disable this?


Solution

  • I asked for help from the official Unity support and we found the problem.
    The problem was with the Unity Analytics Collection, which was enabled by default.

    Unity Ads tried to send data to the dashboard. But for now, Unity Ads is using Google Billing Library v3, when I am v4, it caused an error when submitting data.

    2 solutions were found: