Closed ProZhar closed 5 years ago
@keesvandieren can you fix it, please I have many crashing in production, if people close the app, and then start again it creates multiple connections, early connections don't have observer because it is disposed
@MrStahlfelge there seems to be an issue in GoogleBilling implementation. Can you have a look at it?
@ProZhar if you understand the code, you can submit a PR.
These are two issues here.
@keesvandieren dieren and @MrStahlfelge thanks for answers
2. Crash after calling dispose => the stack trace shows that calling the observer's purchaseCancelled() method fails. This is because the observer is set to null in dispose while a request is performed. I assume purchaseRestore() is called on game start and users immediately closing the game see the crash. This can be fixed by adding null checks to all observer calls from callbacks, but I recommend not to call purchaseRestore automatically.
I think you are right. In my debuging process (see below) I see google keeps all connection where not called endConnection(). Google creates an array of connections and notify all of them. Debugging: -1st variant
2nd variant - is fixed :) It was because 1st start app from AS, then pressed home button, 2nd from Samsung Game Launcher - it creates a new app
2nd variant
1. start 1st app-> created()->1st (BC) created (1st (Obs) exist) ->
2. close 1st app via Launch apps menu (Clear all) -> purchase.dispose() not called ->1st Obs exits
3. start 2nd app-> created()->2nd BC created (2nd Obs exist, 1st BC - exist, 1st Obs EXIST ->
3a. handlePurchaseCanceled() called 2 times - because 1st Obs = exis, 2nd exist too
4. close 2nd app back button -> via Launch apps menu (Clear all) -> purchase.dispose() not called -> 1st BC - EXIST, 1st Obs EXIST and 2nd BC - EXIST, 2nd Obs EXIST TOO
~~In this case I see problem too - I see 2 times called observers methods for tht 1st and 2nd observers
I tryed "Clear All" apps and reopen 5 times in a row - and I see in debug window 5 times called handlePurchaseCanceled() or other methods of the observer~~
@MrStahlfelge
2. Crash after calling dispose => the stack trace shows that calling the observer's purchaseCancelled() method fails. This is because the observer is set to null in dispose while a request is performed. I assume purchaseRestore() is called on game start and users immediately closing the game see the crash. This can be fixed by adding null checks to all observer calls from callbacks, but I recommend not to call purchaseRestore automatically.
In my case I don't call purchaseRestore() on Game.create(). The purchaseRestore() is called only the player press the RestoreButton. I check it, the observer.handleInstall() is always called before purchaseRestore().
@MrStahlfelge This is my app You can try this test:
I see. It will be fixed with the two steps mentioned. I'll add the null checks and call to endConnection next week.
Please build the new version locally and test if this fixes your issues.
@ProZhar do you have any results to share on this?
@keesvandieren @MrStahlfelge yes, thanks. All works fine. You can create new release.
I did not answer for so long, because I spent time solving the error "No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android" when I tried to create the gdx-pay locally build binaries. I found solutions there: there I removed NDK and remove path in File->Project Structure...->Android NDK location
Perhaps you need to add this to README in this place before using
the following command: ./gradlew assemble uploadArchives -PLOCAL
@keesvandieren will you release the new version or use a local build?
@ProZhar the error is because gdx-pay was not yet updated to latest android-build-tools version. Had a quarter of time tonight, but still some errors to go: https://github.com/libgdx/gdx-pay/tree/android-build-tools-3-upgrade
Will continue when I have time, may take a while. If you have time to take it, would be appreciated :-)
@keesvandieren I would love to help, but I don’t know well gradle and its plugin :(
This issue can be closed.
https://github.com/libgdx/gdx-pay/blob/1dade184a96dae53a758988482f4d7397b27249a/gdx-pay-android-googlebilling/src/com/badlogic/gdx/pay/android/googlebilling/PurchaseManagerGoogleBilling.java#L170-L178
In javadocs of BillingClient.java it says:
BillingClient.java
The TrivialDrive v2 sample app shows this has endConnection() too:
TrivialDrive v2 sample app BillingManager.java
I use PurchaseManager.dispose() on the Game.dispose()
In this case all good: start app-> start purchase-> cancel purchase-> home button-> start app-> start purchase-> cancel purchase
But I see crashes in this case: start app-> start purchase-> cancel purchase-> back button (this causes Gdx.app.exit() in my case and PurchaseManager.dispose()) -> start app-> start purchase-> cancel purchase-> -> CRASH REPORT
Sorry for my english. Fix it faster plaese I use your perfect library in production. :)