Skip to content

Fix: Fix crash when querying in-app purchases#454

Merged
d4rken merged 1 commit intomainfrom
fix/billing-double-resume-crash
Mar 20, 2026
Merged

Fix: Fix crash when querying in-app purchases#454
d4rken merged 1 commit intomainfrom
fix/billing-double-resume-crash

Conversation

@d4rken
Copy link
Copy Markdown
Member

@d4rken d4rken commented Mar 20, 2026

What changed

Fixed a crash that could happen when querying in-app purchases or subscriptions from Google Play.

Technical Context

  • Root cause: BillingClientConnection used manual suspendCoroutine callback bridging for billing API calls. Google's Billing Library can occasionally invoke async callbacks more than once (race in BillingClientImpl), and SafeContinuation throws IllegalStateException: Already resumed on the second invocation
  • Fix: replaced all three manual callback bridges (queryPurchasesAsync, acknowledgePurchase, queryProductDetailsAsync) with billing-ktx's built-in suspend extension functions, which handle callback bridging internally
  • billing-ktx:8.0.0 was already a dependency but wasn't being used for these calls

@d4rken d4rken added the bug Something isn't working label Mar 20, 2026
@d4rken d4rken merged commit 039d20d into main Mar 20, 2026
9 checks passed
@d4rken d4rken deleted the fix/billing-double-resume-crash branch March 20, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant