Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved OnPurchaseFailed is not called, Unity 2022.3.5f1+ iap4.9.3, android platform

Discussion in 'Unity IAP' started by densy07, Jul 21, 2023.

Thread Status:
Not open for further replies.
  1. densy07

    densy07

    Joined:
    Nov 27, 2013
    Posts:
    34
    the logcat show:
    2023/07/22 00:01:05.658 25366 25366 Warn ProxyBillingActivity Activity finished with resultCode 0 and billing's responseCode: 1
    2023/07/22 00:01:05.671 25366 25366 Error Unity Exception: No such proxy method: UnityEngine.Purchasing.GooglePurchaseUpdatedListener.onPurchasesUpdated(UnityEngine.AndroidJavaObject,null)
    2023/07/22 00:01:05.671 25366 25366 Error Unity
    2023/07/22 00:01:05.671 25366 25366 Error Unity

    Please check the attached file
     

    Attached Files:

  2. EnberiRoman

    EnberiRoman

    Joined:
    Sep 20, 2022
    Posts:
    6
    The same problem(
     
  3. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    48
    Same issue here. Unity 2022.3.5f1 & IAP 4.9.3

    @Arnaud_Gorain

    Code (CSharp):
    1. Exception: No such proxy method:
    2. UnityEngine.Purchasing.GooglePurchaseUpdatedListener.onPurchasesUpdated(UnityEngine.AndroidJavaObject,null)
     
  4. i9mobile

    i9mobile

    Joined:
    Aug 8, 2013
    Posts:
    54
    same here
     
    noclipstudio likes this.
  5. alexanderkarpets

    alexanderkarpets

    Joined:
    Jun 11, 2019
    Posts:
    1
    Is there an issue on issue tracker?
     
    Last edited: Jul 26, 2023
  6. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    48
    I submitted a bug report (CASE IN-49151)
     
    abbabon and RaceCat like this.
  7. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    48
    In the meantime, I managed to get it working by duplicating the purchasing package (4.9.3) and using it as a local package in which I modified GooglePurchaseUpdatedListener.cs from com.unity.purchasing@4.9.3/Runtime/Stores/Android/GooglePlay/AAR/Listeners and changed the onPurchasesUpdated method at line 53 from private to public, internal didn't work o_O.

    BEFORE
    Code (CSharp):
    1. //com.unity.purchasing@4.9.3/Runtime/Stores/Android/GooglePlay/AAR/Listeners/GooglePurchaseUpdatedListener.cs
    2.  
    3. [Preserve]
    4. void onPurchasesUpdated(AndroidJavaObject billingResult, AndroidJavaObject javaPurchasesList)
    5. {
    6.     IGoogleBillingResult result = new GoogleBillingResult(billingResult);
    7.     var purchases = m_PurchaseBuilder.BuildPurchases(javaPurchasesList.EnumerateAndWrap()).ToList();
    8.     OnPurchasesUpdated(result, purchases);
    9. }
    10.  
    AFTER
    Code (CSharp):
    1. //com.unity.purchasing@4.9.3/Runtime/Stores/Android/GooglePlay/AAR/Listeners/GooglePurchaseUpdatedListener.cs
    2.  
    3. [Preserve]
    4. public void onPurchasesUpdated(AndroidJavaObject billingResult, AndroidJavaObject javaPurchasesList)
    5. {
    6.     IGoogleBillingResult result = new GoogleBillingResult(billingResult);
    7.     var purchases = m_PurchaseBuilder.BuildPurchases(javaPurchasesList.EnumerateAndWrap()).ToList();
    8.     OnPurchasesUpdated(result, purchases);
    9. }
    10.  
     
  8. Arnaud_Gorain

    Arnaud_Gorain

    Unity Technologies

    Joined:
    Jun 28, 2022
    Posts:
    184
    Hi all,
    We are looking into it, stay tuned!
     
    EinsofInnovecs likes this.
  9. EinsofInnovecs

    EinsofInnovecs

    Joined:
    Jan 17, 2022
    Posts:
    1
    Hey ageana, how do you use it as a local package? Just put inside Assets folder? I'm trying but cant compile after that
     
    IndieFist and scvirelvlad like this.
  10. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    48
    @EinsofInnovecs I copied the folder from <PROJECT_FOLDER>/Library/PackageCache/com.unity.purchasing@4.9.3 to <PROJECT_FOLDER>/LocalPackages/com.unity.purchasing@4.9.3 (outside of the Assets folder) and modified the entry in <PROJECT_FOLDER>/Packages/manifest.json to use the local file path

    Code (JavaScript):
    1. // <PROJECT_FOLDER>/Packages/manifest.json
    2. ...
    3. "com.unity.purchasing": "file:../LocalPackages/com.unity.purchasing@4.9.3",
    4. ...
    5.  
     
    JShimojima, jinn97, fulgorr and 4 others like this.
  11. lezzo1469

    lezzo1469

    Joined:
    Mar 7, 2018
    Posts:
    1
    Unity 2021.3.29f1+ iap4.9.3 same
     
  12. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    520
    unbelievable...:eek:
     
  13. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    283
    Hey folks,
    we were able to reproduce the error. I haven't tried @ageana fix yet,
    a quick look with the devs seems that this should work.
     
    RaceCat likes this.
  14. RaventurnPatrick

    RaventurnPatrick

    Joined:
    Aug 9, 2011
    Posts:
    250
    It's hard to understand for us how such a major error can make it's way into a minor update used by Unity LTS.
    Could you also investigate & improve your QA process for such updates?
     
  15. stevenchan_playstudios

    stevenchan_playstudios

    Joined:
    Mar 1, 2017
    Posts:
    39
  16. i9mobile

    i9mobile

    Joined:
    Aug 8, 2013
    Posts:
    54
    Any news?
    Can you please post the link for the issue tracker here so we can follow it?

    I'm trying your fix to move the package to the LocalPackages and I'll update the build and soon I get some data I will post the results here... for now, Unity should update this as SOON AS POSSIBLE!!!
     
  17. i9mobile

    i9mobile

    Joined:
    Aug 8, 2013
    Posts:
    54
    Why it's taking so long to fix it? Just a simple package update will solve this.
     
  18. quanth13

    quanth13

    Joined:
    Sep 27, 2021
    Posts:
    1
    Downgrade Unity to 2021.3.16f1 to fix solve.
    before i use 2021.3.29f1 then downgrade to 2021.3.
     
  19. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    48

    There is no issue tracker link, I think it's only in their internal issue system.

    I received a reply on Monday that they successfully reproduced the issue and it has been sent for resolution with their developer team so I guess a fix will be coming the in the following days/weeks, also I doubt that the fix for this issue will be other than mine.
     
    RaceCat and i9mobile like this.
  20. i9mobile

    i9mobile

    Joined:
    Aug 8, 2013
    Posts:
    54
    I've just use your trick to copy the entire package folder, change the .cs and it works...

    Unfortunately, now I'm getting the following error:

    No such proxy method: UnityEngine.Purchasing.SkuDetailsResponseListener.onSkuDetailsResponse(UnityEngine.AndroidJavaObject,null)

    This may be related to this file:
    \com.unity.purchasing@4.9.3\Runtime\Stores\Android\GooglePlay\AAR\Listeners\SkuDetailsResponseListener.cs

    Any way to solve this the same manner? The methods at SkuDetailsResponseListener.cs are internal... not private
     
    Last edited: Aug 9, 2023
    ageana likes this.
  21. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    48

    You can try the same approach and see if it works, it probably will.
     
  22. Aerilys

    Aerilys

    Joined:
    Apr 19, 2013
    Posts:
    1
    Can confirm that I have the bug in Unity 2021.3.29 with Unity IAP 4.9.3
    Downgrading to 2021.3.23 solved the issue (I don't remember seeing it with x.26 either).
     
    IztokMan likes this.
  23. coldlogic

    coldlogic

    Joined:
    Feb 16, 2021
    Posts:
    10
    It seems all methods in the package with the [Preserve] attribute would be better replaced with public.

    They are...

    onAcknowledgePurchaseResponse
    onBillingServiceDisconnected
    onBillingSetupFinished
    onConsumeResponse
    onPriceChangeConfirmationResult
    onPurchasesUpdated
    onSkuDetailsResponse
     
  24. wouter_vugt

    wouter_vugt

    Joined:
    Feb 25, 2015
    Posts:
    129
    geez, it is so unprofessional to add bugs like this and not have a solution ASAP...
    definitely not the first time either.

    is there an estimate on this?
    Messing with the packages and code might work, but on updating in the future I am sure that would cause other issues.
     
  25. joe_nk

    joe_nk

    Joined:
    Jan 6, 2017
    Posts:
    67
    Jumping in to say that making everything marked as [Preserve] public instead of private/internal worked for us.
     
    RaceCat likes this.
  26. i9mobile

    i9mobile

    Joined:
    Aug 8, 2013
    Posts:
    54
    There's a new version of the package (4.9.4), but it doesn't fix these problems...

    https://docs.unity3d.com/Packages/com.unity.purchasing@4.9/changelog/CHANGELOG.html

    Changelog
    [4.9.4] - 2023-08-01
    Changed
    • Google Play - Billing Library updated to 5.2.1 (was previously 5.1.0). No new feature support was added, this is simply to add compatibility with Android 14.
    • Apple - Using the CrossPlatformValidation (or AppleValidator), receipts will now be validated if their certificate chain is encoded in SHA-256 instead of SHA-1. Old receipts encoded in SHA-1 will still be validated. See Apple Technical Note.
     
  27. joe_nk

    joe_nk

    Joined:
    Jan 6, 2017
    Posts:
    67
    Yep - We're on 4.9.4 too. Local package will do us for the time being.
     
  28. wouter_vugt

    wouter_vugt

    Joined:
    Feb 25, 2015
    Posts:
    129
    decided to it this way for now too, never going to buy Unity stocks lol
     
    distriqt likes this.
  29. Arnaud_Gorain

    Arnaud_Gorain

    Unity Technologies

    Joined:
    Jun 28, 2022
    Posts:
    184
    This issue is under our radar for a later release.
    If you have questions, feel free to reach out.
     
  30. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    @Arnaud_Gorain @SebT_Unity Can we have an answer to this, please?
     
  31. MianAbdul

    MianAbdul

    Joined:
    Mar 31, 2017
    Posts:
    19
    @domonyiv Unity's QA team is the legendary team of the world, along with the developer team. They release complete unity-LTS after every week or max two weeks. I think they actually put their code in bugs, and the QA team checks the new code block whether it is working or not it doesn't matter.
     
  32. IztokMan

    IztokMan

    Joined:
    Sep 8, 2019
    Posts:
    2
    Yep, can confirm that also 2021.3.27 + iap 4.9.3 works ok. The bug was probably introduced in 2021.3.28 or 2021.3.29.
     
  33. Arnaud_Gorain

    Arnaud_Gorain

    Unity Technologies

    Joined:
    Jun 28, 2022
    Posts:
    184
    Hi @domonyiv,
    The QA process involves a lot of packages across the different editor versions, which also can be or not an IAP dependency, involving multiple different teams.
    Each team takes time to ensure the quality of their releases at the best of their bandwidth.

    If you have questions, let me know.
     
  34. p0w1nd

    p0w1nd

    Joined:
    Oct 28, 2015
    Posts:
    141
    Same for me. Unity 2022.3.5f1 + IAP 4.9.4

    Exception: No such proxy method: UnityEngine.Purchasing.GooglePurchaseUpdatedListener.onPurchasesUpdated(UnityEngine.AndroidJavaObject,null)

    And @ageana 's workaround works for me. Thanks!!!
     
    Last edited: Aug 18, 2023
    DiacPaulAlexandru likes this.
  35. RaventurnPatrick

    RaventurnPatrick

    Joined:
    Aug 9, 2011
    Posts:
    250
    In this case the given Team (Unity IAP) released a minor update for a Unity LTS version - however they thereby broke their own package on Android (many of the common purchase scenarios don't work as expected anymore)

    You should really escalate such issues internally to upper management, as it is not acceptable to hope each individual sub-team will ensure the quality.

    Also I cannot understand why such package updates have to be pushed directly into an LTS release? Isn't the point of having alpha/beta etc. release so every core component (including core packages) can be tested by the user-base before you break a Unity LTS version?

    If that's not the case, Unity should re-evaluate their internal process to ensure high quality rather than frequent updates
     
    breban1, milesLogan and domonyiv like this.
  36. FamishedMammal

    FamishedMammal

    Joined:
    Nov 3, 2015
    Posts:
    113
    Still seems to be an issue
     
    Last edited: Aug 18, 2023
    gubbi likes this.
  37. ion_unity

    ion_unity

    Joined:
    Jul 23, 2020
    Posts:
    6
    Hello everyone,

    I'm also facing the same issue with Unity version 2022.3.7 and IAP package version 4.9.4. I haven't made any changes to the in-app purchasing code; I simply updated to the latest IAP version and started experiencing these issues.

    Has anyone tried this with newer Unity versions to see if the problem persists? It would be helpful to know if there's a version where this issue has been resolved.

    I'd also like to know if there's an easier way to fix this issue, as I have multiple projects that need to be updated and would prefer to avoid modifying the source code of the IAP package in each of them. Does anyone know if it's possible to revert to an older version of the IAP package in the latest Unity version?

    Thanks in advance for any help.
     
  38. FamishedMammal

    FamishedMammal

    Joined:
    Nov 3, 2015
    Posts:
    113
    You can downgrade to an older version by uninstalling the package, then following these steps (just replace 4.x.x with your desired version number):
    downgrade.png
    I am using version 4.8.0 in Unity 2021.3.27f1, and OnPurchaseFailed() works as expected
     
    ion_unity likes this.
  39. ion_unity

    ion_unity

    Joined:
    Jul 23, 2020
    Posts:
    6
    Thank you for the suggestion @FamishedMammal .

    I tried downgrading to IAP versions 4.9.2 and 4.8.0, but unfortunately, neither worked with my current Unity version (2022.3.7).

    Has anyone successfully downgraded the IAP package in Unity 2022.3.x and had OnPurchaseFailed() work as expected? Or is this issue only resolvable in older Unity versions?

    I appreciate any further guidance.
     
    onurerler and RaceCat like this.
  40. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    144
    Unity 2021.3.29
    In App Purchasing 4.9.4
    Error:
    Non-fatal Exception: java.lang.Exception: Exception : No such proxy method: UnityEngine.Purchasing.SkuDetailsResponseListener.onSkuDetailsResponse(UnityEngine.AndroidJavaObject,null)
     
  41. FMGdev

    FMGdev

    Joined:
    May 5, 2021
    Posts:
    6
    Unity 2022.3.6
    In-App-Purchasing: 4.9.4

    Code (CSharp):
    1. Exception: No such proxy method: UnityEngine.Purchasing.GooglePurchaseUpdatedListener.onPurchasesUpdated(UnityEngine.AndroidJavaObject,null)
    The solutions mentioned before make the game raise ANR. I will be waiting for the fix.
     
  42. ion_unity

    ion_unity

    Joined:
    Jul 23, 2020
    Posts:
    6
    Just wanted to give a quick update. I've tested the new Unity 2022.3.8 with IAP 4.9.4, and unfortunately, the issue persists. OnPurchaseFailed is still not being called, and it appears the problem hasn't been addressed in this latest Unity update.

    As of now, the release notes for 2022.3.8 haven't been published, but based on my tests, it seems the issue is still unresolved.

    I'd like to hear if anyone has found a workaround or if there's an upcoming fix that anyone is aware of. This issue is causing quite a bit of inconvenience, especially with multiple projects needing updates.
     
    onurerler likes this.
  43. ion_unity

    ion_unity

    Joined:
    Jul 23, 2020
    Posts:
    6
    Thanks for acknowledging that this issue is on your radar for a future release. Given that many of us are experiencing the same problem, could you provide any estimated timeline for when this might be fixed?

    Additionally, do you have any recommendations for those of us who want to stick with Unity 2022 versions? I've noticed improvements in ANRs with that version, and I'd prefer not to downgrade if possible.

    Looking forward to your insights.
     
  44. akshaypro02

    akshaypro02

    Joined:
    Jan 14, 2020
    Posts:
    10
    works great :):):):) just be sure use clear build
     
  45. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    521
    I added the localpackage and also modified the preserve method to be public and i cant see the exception.
    So this solution may work right now until unity releases a patch.
    Unity 2022.3.8f1
    In-App-Purchasing: 4.9.4
    MacOs Ventura.
     
  46. merenpta

    merenpta

    Joined:
    Feb 27, 2016
    Posts:
    3
    I raised the Unity version from 2020 to the latest version 2022.3.7f1 to raise the Android target version to 33. This caused problems. (Cocoapods Error (iOS), Resolve Error, Build Error, etc.) While removing the Android plugins one by one, the build succeeded and I found this problem (IAP). So I built with a more recent version, 2023.1.10f1, but the problem still occurs.
    I'm not sure which version exactly the issue started with, but after changing to 2022.3.4f1 all issues were resolved.
    There is no problem with the IAP package. Change your Unity version to a version prior to July.
     
    Last edited: Aug 26, 2023
  47. nanotribegmbh

    nanotribegmbh

    Joined:
    Sep 13, 2017
    Posts:
    7
    This works 100%. Unity devs; can't you apply this ASAP, release a hotfix for the IAP library and later fix it properly if you really need to?
     
    domonyiv, MaximPP, dimatiyer and 4 others like this.
  48. MaximPP

    MaximPP

    Joined:
    Jan 26, 2019
    Posts:
    76
    Thanks! It works! It's been a month since this post!:eek: Why can't Unity release this hotfix ASAP?
     
  49. ion_unity

    ion_unity

    Joined:
    Jul 23, 2020
    Posts:
    6
    Hi everyone,

    Just a quick update from my end. I can confirm that downgrading to Unity 2022.3.4f1 resolved the IAP issue for me as well. OnPurchaseFailed is now being called as expected.

    If you're struggling with the same issue and want to stick with Unity 2022 for its improvements, you might want to consider switching to this version until a fix is released for the newer ones.
     
  50. jinn97

    jinn97

    Joined:
    Oct 22, 2020
    Posts:
    23
    Thank you for the solution!
     
Thread Status:
Not open for further replies.