Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Play Store crash on Unity IAP 4.5.1

Discussion in 'Unity IAP' started by willumbolt, Nov 15, 2022.

  1. willumbolt

    willumbolt

    Joined:
    Oct 21, 2019
    Posts:
    3
    Hi,

    We've recently updated our App from Unity IAP 4.1.4 to 4.5 (we're now on 4.5.1) so that we have Google Billing 4.0, and have seen a rise in Native crashes on Android devices on our dashboard. We've established that most of these are coming from Xiaomi, Huawei and Vivo devices.

    One of our test devices (Umidigi running Android 8.1) is also displaying a crash we think might be related to these dashboard ones.

    When a purchase is completed (successfully), the store will hang for a bit and then show the error message on screen "Google Play Store has stopped". The logs show a DeadObjectException but are empty of any errors otherwise, so we don't have much to go off of.

    We have established that the code is returning PurchaseProcessingResult.Complete even when the store crashes. However, on occasions where the store does crash the purchase is then later refunded by google. Unfortunately this means the player keeps the IAPs.

    One "fix" we've found is that by tapping on the screen whilst the purchase is processing the crash doesn't show and the purchase isn't later refunded.

    Any ideas on what might be causing this? We didn't have this issue before updating.

    Unity Editor - 2020.3.32f1
    Unity Services Core - 1.4.0
    Unity Analytics - 3.8.1
    Unity Services Analytics - 4.2.0
     
  2. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    226
    Hello,

    This might be related to a threading issue since tapping on the screen prevents the crash. I would suggest updating Services Core to 1.6.0 which solves some of these cases.

    We also have other threading issues that will be fixed for 4.5.2, but it's hard to tell if your case is a new or known case.
    Would you be able to provide the logs even if there's no errors shown to help us determine that?

    For the purchases being refunded, this is because the application crashed before FinishTransaction was called on the pending purchase. On the next start of the application, the pending purchase should be going through ProcessPurchase again where it would be possible to confirm it.
     
  3. willumbolt

    willumbolt

    Joined:
    Oct 21, 2019
    Posts:
    3
    Thanks for your response.

    We've tried updating Unity to 2020.3.41f1 today as well as updating Services Core to 1.6.0. Unfortunately our test device still has the same issue.

    We haven't rolled it out so cannot confirm if it fixes the crashes we are seeing in our dashboard, but if our test device is still having issues we're assuming it probably won't.

    As requested here are our logs from our test device. They're not giving us much to work from.
     

    Attached Files:

    • log.txt
      File size:
      9.5 KB
      Views:
      183
  4. flintcheeze

    flintcheeze

    Joined:
    Sep 10, 2015
    Posts:
    80
    Just incase you can test run your apk on android phone using internal sharing or the native build to apk I will be glad if you can share how you worked it out cause my game installs but crashes instantly at startup , I have Unity ads 4.4.1 and in-App purchase 4.5.1 and GooglePlay service SDK… and also I think the issue with in app purchase crashing could be device specific too… apologies I should have created a new thread for that topic but looking at the previous threads created on that topic with a concrete solution and narrowed my search down to asking those who are able to successfully install their apk and test it without crashing on start.
     
  5. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hi @willumbolt,

    We're looking into this DeadObjectException. I'm not exactly sure why you're experiencing it, but it seems to be related to a java-side garbage collection. Most of our implementation is in C#, wrapping java objects. We'll investigate to see if there's some unsafe usage of C#-wrapped java objects.

    Sorry for the inconvenience, but this is the first thread reporting this.

    Looking an a thread for another SDK within Unity, it seems the problem was on the specific Phone's System Software, which a patch fixed, but we should not rule out that the IAP usage may be something that can be fixed.

    We'll get back to you once we find something.
     
    Last edited: Nov 17, 2022
  6. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hello!

    Small update: we already had put garbage collection around the call to the BillingClient implementation for
    queryPurchasesAsync
    . It could be something else, but that's the obvious vector I see where our SDK could have been at fault. I'll keep looking.

    Is it specifically those phones? Are their native (as in non-Google) system softwares up-to-date?
     
  7. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Another question:

    Am I understanding this correctly that this is happening after the purchase is completed, but during the Confirmation of the purchase (consuming consumables, or acknowledging non-consumables)? Is the refunded product a consumable by chance (and therefore why the player is keeping it)?
     
  8. flintcheeze

    flintcheeze

    Joined:
    Sep 10, 2015
    Posts:
    80
    I think you should upgrade to Unity 2022.1.23f1 it did the trick for me
    Everything works well now
     
  9. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Finally, when you refer to "Native crashes" or the "Store Crashes". what's crashing, you app, or the Google Play Store overlay?

    If it's just the overlay crashing, we may be able to catch the error in your app and log it.
     
  10. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    @flintcheeze

    That's good news! Which editor were you on before?

    I do know that the Android compilers have been updated in subsequent Editor versions.
     
  11. flintcheeze

    flintcheeze

    Joined:
    Sep 10, 2015
    Posts:
    80
    I was on 2021.3.11f1
    I think the error had to do with Vulkan and OpenGL mismatch
     
  12. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Interesting
     
  13. flintcheeze

    flintcheeze

    Joined:
    Sep 10, 2015
    Posts:
    80
    So today as it may seem the crash still exist with Unity Ads targeting Api level 33 as the highest… created an empty project with only play games services which worked and then I added Unity Ads 3.6.0 and built it and it started crashing
    Note I have Unity Ads 4.5.1 on my main game and it still also crashes on start
    How ever the empty project shows Unity logo and then crashes… I will clear dependencies and try again
     
  14. willumbolt

    willumbolt

    Joined:
    Oct 21, 2019
    Posts:
    3
    @John_Corbett thank you for your responses.

    Our test device we're seeing an issue on is an Umidigi One. However this is the only test device we see issues with. The crash it experiences is to do with the Play Store overlay specifically, and it happens at some point after we've called PurchaseProcessingResult.Complete in our code, so after the purchase is completed.

    The IAPs are non-consumable and are instead one-off DLC type purchases. These are then later refunded. We've checked its software and its all up to date.

    The crashes we're seeing in the Unity Dashboard show as Native Crashes, but our personal Info logging is suggesting that its happening around the same time as the crash on our test device. These are new with 4.5.0 and 4.5.1 and we believe we're seeing the same purchase issue. Unfortunately the stack traces have little to no information.

    The trend between these dashboard Native Crashes is that they're for the most part Xiaomi, Huawei and Vivo devices.

    We do have a Huawei we tested on but couldn't replicate any issues.